PDA

View Full Version : render a scene without an opengl window



lgnnn
06-01-2003, 12:16 AM
i want to write an opengl program that it can render the scene but it has no
opengl window. it record the rendered images in files. who can give me some
suggestion on how to do it or some similar opengl code?thanks very much

V-man
06-01-2003, 12:24 PM
You need to have a window and set the pixel format (on windowing GUI anyway).

PS: Did you do a search to try to find some information before posting this?

Nutty
06-01-2003, 02:40 PM
You could probably do it with a PBuffer. Render to that, and you should be able to copy the data out, without the need to create a window.

jwatte
06-01-2003, 03:37 PM
You need to create a window to get a context so that you can get the extensions for using pbuffers, though. However, nothing says that this window has to be visible :-)

*Aaron*
06-01-2003, 05:02 PM
If you're using Windows, you might be able to to choose a pixel format with the PFD_DRAW_TO_BITMAP flag without creating a window. As far as I know, only the generic implementation can do this, so you'll be limited to (almost) unextended OpenGL 1.1. This all assumes that it is possible to get a handle to a device context for the desktop, which I'm not sure of. You might want to look into this, though.

lgnnn
06-01-2003, 05:05 PM
i have found something http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnopen/html/msdn_gl6.asp
but my program is written in glut. i really don't know how to deal with it under glut.

neywat
06-16-2003, 11:44 PM
you can use the glCopyPixels function tu grab what you have on a portion of the
window (or on the entire window) into a buffer. Notice that the size of a line of your image must be align on a multiple of 4 (so take care qhen reserving
memory for the buffer). You can then write the contents of the buffer into
a file (like a BMP for example).