PDA

View Full Version : render without creating a window?



Vidal
04-27-2004, 10:29 AM
Hi all!
I want to create a program that renders an openGL scene without creating any window. I need to do this because this is for a GIMP plugin than will open some file formats i render with OpenGL. The idea is to render the image with the desirable values (rotation,scale,shadows,...) and then read this an pass it to the GIMP. I think I canīt do this with glReadPixels() but iīm not sure.

Other idea I had was to redirect a buffer in openGL to a layer in a GIMP image so I can interact directly with OpenGL and donīt need to reload the image every time any value chages, but i think itīs impossible or almost very difficult.

Any idea? Thanks

Zengar
04-27-2004, 11:44 AM
You can't do any OpenGL rendering without a window. Why? It's simple - you need a window handle. If you īwrite fro GIMP it would mean that you are under linux, right? Got no clue how one program under linux, but that's how I would do it under windows:
I would create a fake window(not visible one, for example) and make a context for it to querry the pbbuffer extensions. Than I would create a pbuffer etc... and then comes ReadPixels or GetTextureImage

dorbie
04-27-2004, 11:51 AM
Well you'd normally use pbuffers for this to get an offscreen rendering context. There are a couple of ways to go. One would rely on hardware rendering capabilities and offscreen pbuffer contexts, the other would be to use Mesa software rendering to an offscreen buffer, that may be the fallback of the DRI anyway but your results would be more consistent and less prone to driver implementation issues. This is old info but still useful, the pbuffer extension has become more standard since then and ofcourse the whole DRI infrastructure is in place for Linux with the Mesa software path too:

http://www.mesa3d.org/brianp/sig97/offscrn.htm