View Full Version : Saving 3d-scene to BMP file without X-session.

03-15-2004, 06:42 AM
Hi, All
It is possible to save OpenGL 3d scene (buffer) to BMP file under Linux without X-session? Under Windows I can use PFD_DRAW_TO_BITMAP and bitmap device context, but what about Linux? Can anybody give me example of simple CONSOLE application to saving some OpenGL scene to BMP file without X-session.
Thank you.

03-15-2004, 10:00 PM
You're supossed to use libosmesa ("off screen") to do that. I haven't done this, however; I don't know how well may it work.

03-16-2004, 11:21 AM
If you want to save a shot from within your app then simply use glReadPixels to read the whole framebuffer and either use a library (like DevIL aka OpenIL) or write some code to save it to a file. If you want to take a screenshot from an external application just use google to find one.

PS: AFAIK osmesa is used to render to an off-screen pixmap instead of a window. It could be used for this I suppose but it's not necessary or better in any way (again: AFAIK)

[This message has been edited by zen (edited 03-16-2004).]