View Full Version : FBO stencil test

07-02-2010, 03:09 PM
Hey all,

I have a question for you: Is it possible to do a stencil test with an FBO when drawing geometry to the main framebuffer? I'm trying this so I can draw a skybox in my deferred renderer, I've read some of the forum postst on the subject, but they were not helping a lot.

My best guess would be to blit the fbo to the backbuffer and then perform the stencil test but it doesn't seem to be working out for me. any ideas / solutions?


07-04-2010, 11:00 PM
You should be able to blit just the stencil buffer from
the FBO to the backbuffer's stencil buffer, provided they
are both in the same format.

Mikkel Gjoel
07-08-2010, 03:10 AM
Completely dodging your question, you should be able to render your skybox by simply checking against the depthbuffer.

So for example:
- clear depth+color
- render g-buffers
- calculate lighting from g-buffers, outputting into colorbuffer1
- render your skybox to colorbuffer1 (checking against your original depthbuffer)
- post-process colorbuffer1

Hope this was helpful.