Background rendering?

Is there any way to render a scene, capture the framebuffer back into system memory and save it to the disk, all without actualy displaying a window on the desktop?

Originally posted by tbc++:
Is there any way to render a scene, capture the framebuffer back into system memory and save it to the disk, all without actualy displaying a window on the desktop?
If you have the data in memory, why not create a bitmap in the file format of your choice? There are lots of freeware file writer/readers out there.

What I want to do is be able to render the image without displaying a window on the desktop. Kindof a “silent” render.

You can attach a context to a window, render, and read back the back buffer without ever calling SwapBuffers(). However, this will not work right when the window is partially or wholly obscured.

What you really should do is create a pbuffer, and create a context on that, and render and read back.

Thus far, I only program on Mac, so I don’t know too much about other OSes/windowing systems, but on OS X, there’s an OFFSCREEN attribute you can use when creating a context for doing exactly this - surely the other systems would have something similar?

Originally posted by charliejay:
Thus far, I only program on Mac, so I don’t know too much about other OSes/windowing systems, but on OS X, there’s an OFFSCREEN attribute you can use when creating a context for doing exactly this - surely the other systems would have something similar?
Unless speed is a non-issue, do NOT go this route. NONE of the offscreen renderers for OS X are hardware accelerated; they’re all done in software. However, an offscreen renderer allows you to specify the memory region that the buffer is written to, so that makes it easier to get the pixels when you’re done.

Check out pbuffers, they should be able to do what you want to do.