Offscreen bitmaps

Though a good Windows programmer I am quite new to OpenGL which I am trying to use through Delphi. The problem I am trying to deal with is this:

I want to get OpenGL do draw not to a Window but to an offscreen bitmap.

The reasons for wanting to do this are complicated and go deep into the application context within which I need to use OpenGL, but briefly it is partly to do with the fact that in my application I have to trap WM_ERASE_BKGND and WM_PAINT to handle painting of different parts of the window in a very unusual way.

Only one of those parts is to be rendered using OpenGL and I want to continue using the approach I use with the other parts - paint to an offscreen bitmap and then do a BitBlt.

I have found that simply doing ChoosePixelFormat with PFD_DRAW_TO_BITMAP (with a Windows bitmap DC) and then calling SetPixelFormat fails - which I gather must be because what OpenGL calls a bitmap is not quite a Windows bitmap.

However, I suspect that there must be a way. Any help will be greatly appreciated.

pbuffers are coming. AFAIK most hardware should support drawing to pixmaps - hell, they can do it in DirectX!

If you look at recent ARB meeting notes, they are banging out the semantics of this ‘pbuffer’ thing - hopefully it’ll arrive soon…

Matt if you’re here, do any NVidia cards support WGL_pbuffer_EXT or whatever its called?

In other words you are saying that as yet it cannot be done?

I might as well add the solution in case anyone else reads this. Quite simple really - simply use the following


At this point we have a memory DC which can be used in the same way as a Window. Do all the OpenGL stuff and then BitBlt

[This message has been edited by Atul (edited 11-07-2000).]