View Full Version : render a scene without an opengl window

06-01-2003, 12:15 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

06-01-2003, 02:11 AM

I think You should first create an OpenGL window and then using glReadPixels write the scene into files. I don't think that there is a way to do this without creating OGL window, maybe it's possible to draw primitives in the back buffer and copy the buffer's data into the file but I didn't work on it yet.


06-02-2003, 03:34 AM
There's effectively no way to use GL without a window around (you need a render context after all) but you can work around it by making the window so is not displayed at all.
Starting it iconified for example.

06-02-2003, 03:47 AM
maybe call ShowWindow(hwnd, SW_HIDE);


06-02-2003, 05:04 AM
From the spec :
ReadPixels obtains values from the selected buffer from each pixel with lower left hand corner at (x+i; y+j) for 0 <= i < width and 0 <= j < height; this pixel is said to be the ith pixel in the jth row. If any of these pixels lies outside of the window allocated to the current GL context, the values obtained for those pixels are undefined. Results are also undefined for individual pixels that are not owned by the current context.The last sentence clearly states that pixels that don't belong to the RC (see pixel ownership test) have undefined values in the framebuffer. For a hidden or minimized window, no pixel is owned by the RC, that is, the whole framebuffer content is undefined.

The proper way to go is to use pbuffers.

[This message has been edited by kehziah (edited 06-02-2003).]