GL_EXT_packed_depth_stencil bug


We use OpenGL and we really need stencil buffer in FBO. We tried to use


and it works great on ATI! But we could not make it work on GeForce 6600 with latest drivers installed… Although OpenGL shows that this extension is supported.

We thought that we might be missing something and used a sample from the extension specification (
Unfortunately that sample did not work also.

We get the following error when we’re getting framebuffer status after creation:

Also when we’re trying to create depth buffer and stencil buffer separately it also does not work.
Looks like GL_EXT_packed_depth_stencil is the only way for us to get to stencil buffer on this videocard.

Maybe someone had same situation?
Has anyone successfully created stencil buffer in FBO on NVidia?

If so, could you please post code that you use to create the framebuffer?

glGenRenderbuffersEXT(1, &renderbuffer);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_STENCIL_NV, renderbuffer_width, renderbuffer_height);

Seems to work just fine on my Quadro FX 1600M


works fine even on GF6200, drivers 169.x

Do not forget to bind it to both depth and stencil attachments:


Thanks everyone. We won the battle for stencil creation, but now have strange results in using it/

No matter how we fill the stencil - glClear() with specific value, or by drawing into it - same thing. If then we’re using mask with NOT_EQUAL, LESS or GREATER - stencil test never passes.

but if we set EQUAL, test passes always, no matter what is beeing compared to values in stencil.

plus it works on ATI just fine.
We might be missing something, or it might be really problems with drivers.

Can anyone share really simple example of using stencil in FBO that can be compiled and run, to see if it really works here.

When I was working on something related to this about a year ago, I found that packed_depth_stencil worked fine on a Quadro 4500 under XP, but produced garbage under Linux. Which OS are you on?

under XP. problems only with stencil. depth buffer works fine (using packed_depth_stencil ext)…

if you have some working sample to share - I would appreciate it so much!

There were problems with the stencil mask reported on this forum when the windows’ pixelformat has no stencil and the FBO has.
The stencil mask was set to zero although it should be ~0 for all bits per default.
Try explicitly setting the stencil mask once during init.

Replic, thank you!

the problem was really in that mask was set to 0 although specification says it won’t.

solution deffers little - we got to set the mask every time after FBO binding.

Thanks again!