View Full Version : Render to buffer that is never displayed?

Henry Holmes
06-02-2008, 03:17 PM
I'm working on a C++ class that would use OpenGL occlusion queries to calculate what percentage of objects are occluded from different points of view. That's all-- no need to display them, ever, except during debugging.
So far I have the code to do that done, except that it displays the window the rendering of the occluders as it does its work. I'd like to be able to make that hidden. So does anyone know how to get a rendering context for a framebuffer that is never displayed? Preferably this would be cross-platform but I doubt that is possible. For single platform solutions I am using Ubuntu.

06-02-2008, 03:24 PM
Use FBO. You will probably still have to create a window to get a GL context, then everything else can be hidden on a Framebuffer object.

06-02-2008, 04:00 PM
Occlusion queries count samples that pass the depth test. So if you disable color buffer writes (with glColorMask), you will get what you want. You still have to use the depth buffer, though.

If I misread your question and you just need "no window", then use FBOs as ZBuffeR said :)