get back buffer DC


I’m trying to use GDI function(ex BitBlt) at back buffer. However, I could not find any information about getting HDC for back buffer. When I call wglGetCurrentDC, it seems like I got DC for front buffer.

How can I get HDC for back buffer?

Any help will be appreciated.


You can not use GDI functions with OpenGL.
That’s a limitation and you can not do anything about it…

If you want to access the Front or Back buffer, you have to use glReadPixels/glDrawPixels after having selected your buffer.

What do you want to do exactly ?


I’m doing some unusual thing.(Everyone thinks he’s doing unusual thing :slight_smile:

I made an openGl wrapper which converts Quake3 into stereoscopic Quake3.

With the wrapper, I intercept some OpenGl calls and render twice at different viewpoints. Now I got an Side-by-Side image where a Left-eye-viewed image is in the left half of the screen and right-eye-viewed one in the right half.

I’m using VRJOY, a 3D glasses which needs a interleaved stereoscopic image. That is, Left image should be in add lines and Right image in even lines.(or vice-versa).

I have to make an interleaved image from side-by-side one.

I tried glCopyPixel but it was very slow. Also, I tried stencil buffer but it seed like most of opengl accelerator does not support stencil buffer. Software stecncil operation was very slow.

So, I tried to use “BitBlt” or “stretchblit” to make an interleaved image. To do this, I need to access the back buffer.

I also tried to use DirectDraw surface because DirectDraw’s Blit is very fast and most of VGA card supports hardware blitting. However, when DDraw take over the full screen, I could not accss the OpenGL’s front(back buffer too) buffer. I think the front buffer DC is lost when DDraw prevails.

That’s what I’m doing. I thought it would be easy to make an interleaved image once I have a Side-By-Side image. Now I’m feeling shortage of OpenGL function. Well… anyway basically OpenGL is just for 3D. I think 2D support should be done by O/S.

Is there anyone who can help me with this?
I can offer some money. :slight_smile: