I'm writting a program that needs OpenGL to render to a Bitmap rather than a window.
However, when I specify PFD_DRAW_TO_BITMAP in the PIXELFORMATDESCRIPTOR, it seems that alpha bits are not written to the bitmap. Colors work as expected... and I know it's rendering properly, since I have a few read pixel loops to varify the results. This is really frustrating and about to switch to Direct3D if there isn't a solution. I can only use Opengl version 1.2... and I can't use glReadPixel or Transfers of any kind since I get 1/3 speed increase in my algorythims not using them. The whole point of DRAW_TO_BITMAP was to elliminate the pixel transfer overhead.
I have tried many variations to the code below, including zero alpha bits, alpha shift's, stencil bits, flags, depthbits and color bits. Nothing seems to work what so ever. Only when using the PFD_DRAW_TO_WINDOW are the alpha bits written to the main buffer.
I'm unfamiliar with opengl, but from my experience using other graphic functions, I noticed that no graphic function will handle the alpha chanel if it's not specially designed to do so.
For what you want to achieve, try to find opengl functions explicitely designed to deal with transparency.
Bookmarks