Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stencil buffer depth in OpenTK

I`m using OpenTK for OpenGL and C#.

I need to use stencil buffer and currently wondering how do I set StencilBuffer depth.

As I know earlier was TaoFramework and it`s control had property where this depth could be seted.

But now in openGlControl from OpenTK I can not find such property. As I know current seted buffer depth can be obtained by calling GL.GetInteger() method passing to it special parameter. 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.

Can anyone help me?

like image 347
steavy Avatar asked Mar 21 '13 14:03

steavy


1 Answers

Looks like you set it up when you create the graphics context:

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.

like image 188
Nathan Monteleone Avatar answered Sep 26 '22 01:09

Nathan Monteleone