off-screen rendering

I have short experimental program that build the window, render openGl image, print it into window, read pixels and save image into file. I need to change it into off-screen image rendering without window. I tried to allocate buffer with CreateDIBSection and use glReadPixels at the end. It did not work.
Does anyone have similar experience?
Thanks.

Currently it’s impossible without a window. You need PFD_DRAW_TO_WINDOW in your pixel format to get hardware acceleration. Otherwise you get MS GDI Generic implementation.

The usual way to do it is to create a hidden window, and render to pbuffers. FBOs will replace pbuffers shortly, but you still need a window to create the rendering context.

I had a similar problem (check out the replies on my post on 23-12-2004 on this forum). You do not need to make a window (hidden or otherwise) to make a device context for a rendering context; the device context of the screen can be used by calling CreateCompatibleDC(NULL).

Hope it helps.
Pete.

Thank you all. I found solution it is possible and working. I made it with CreateCompartibleDC and CreateDIBSection(…) functions. Image is written into bitmap located in the memory and read by glReadPixels(…). That techinque is implemented in my demo
http://www.graitler.com/gilink
Who knows how to make this technique multithreaded? That means to provide concurrent calls to CreateCompartibleDC and glReadPixels providing construction of different images concurrently.
Pete, special thanks for you.
Regards.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.