简体   繁体   English

OpenTK中的模板缓冲区深度

[英]Stencil buffer depth in OpenTK

I`m using OpenTK for OpenGL and C#. 我将OpenTK用于OpenGL和C#。

I need to use stencil buffer and currently wondering how do I set StencilBuffer depth. 我需要使用模板缓冲区,当前想知道如何设置StencilBuffer深度。

As I know earlier was TaoFramework and it`s control had property where this depth could be seted. 我之前知道的是TaoFramework,它的控件具有可以设置此深度的属性。

But now in openGlControl from OpenTK I can not find such property. 但是现在在来自OpenTK的openGlControl中,我找不到这样的属性。 As I know current seted buffer depth can be obtained by calling GL.GetInteger() method passing to it special parameter. 据我所知,当前设置的缓冲区深度可以通过调用GL.GetInteger()方法传递给它的特殊参数来获得。 And when I do so it returns 0. This means that currently stencil buffer depth is zero, so any operations won"t have result untill some buffer depth is seted. But I can`t find out how to do this. 并且当我这样做时,它返回0。这意味着当前模具缓冲区深度为零,因此在设置了某些缓冲区深度之前,任何操作都不会产生结果。但是我无法找到方法。

Can anyone help me? 谁能帮我?

Looks like you set it up when you create the graphics context: 看起来像在创建图形上下文时进行了设置:

http://www.opentk.com/doc/graphics/graphicscontext http://www.opentk.com/doc/graphics/graphicscontext

Close to the top of that document it gives the following example: 该文档顶部附近提供了以下示例:

// Creates a 3.0-compatible GraphicsContext with 32bpp color, 24bpp depth
// 8bpp stencil and 4x anti-aliasing.
GLControl control = new GLControl(new GraphicsMode(32, 24, 8, 4), 3, 0);

This is typical -- OpenGL basically punts this sort of thing to the OS-specific context creation task... So if you weren't using OpenTK for example you'd have to set this up with wgl and the windows api. 这很典型-OpenGL基本上将这种事情拖到了特定于OS的上下文创建任务中。因此,例如,如果您不使用OpenTK,则必须使用wgl和Windows api进行设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM