Rendering to buffer for off-line storage


In my application, at some point I’d like to use OpenGL to fill a framebuffer that I want to have saved. Performances doesn’t matter, but I need to ensure that my scene is rendered properly and not overlapped by some other operating system window.

glReadPixels() on my regular GL context doesn’t seems to ensure that, eg: on a command-line version of my tool, I often get windows garbage over my buffer. What I’d like to do eventually is to render directly into RAM.

Are PBuffer the solution?
Anything easier?
It is possible via Windows/WGL (sorry this isn’t stricly a GL question, then) to create a DC that doesn’t map to the screen but to RAM?

I’m running Windows XP, Radeon 9800 if that matter.



PBuffer could be used but they are obsolete and replaced by the FBO extension.
Check Google for off-screen rendering.


As Ido said, use the GL_EXT_framebuffer_object extension (just in case you didn’t know what FBO is). The specification in the registry has a small usage example at the end that is usually enough to get started.

Thanks for your answers.
How’s the hardware/driver support for FBO?
Since when are those decently supported by hardware and/or drivers?
Want to make sure that 2-3 y/o hardware won’t get stuck due to FBO usage.