CreateCompatibleBitmap Question

Started by
-1 comments, last by lost hope 21 years, 7 months ago
Hey, I'm currently trying to create a layered window so that I can perform windo blending in winXP and 2k. In order to get this to work with OpenGL, I am attempting to read the pixels in the framebuffer to a bitmap, and then call UpdateLayeredWindow with the new bitmap. Here is some of the code, where the variable "output" is the buffer containing the color data from the framebuffer: HDC memHandle = CreateCompatibleDC(g_hDC); HBITMAP newBM = CreateBitmap(g_width, g_height, 1, 24, output); SelectObject(memHandle, newBM); UpdateLayeredWindow(g_hWnd, g_hScreenDC, &scr_loc, &scr_size, memHandle, &ptSrc, 0, &blend, ULW_ALPHA); However, SelectObject always fails, indicating that newBM is not a valid region. Instead, I was going to try and create the bitmap using the function: CreateCompatibleBitmap(HDC hdc, int nWidth, int nHeight); However, what I don't understand, is how you get the actual pixel/color information into this bitmap? Does anyone know how to do this? Or maybe you have some other suggestion as to the best way to get a valid handle to a bitmap (HBITMAP) using glReadPixels and some windows API calls? If this is unclear, or you need to see more of the code, just let me know. Thanks! [edited by - lost hope on August 27, 2002 10:51:54 PM] [edited by - lost hope on August 27, 2002 10:52:16 PM]
"The difficult part of living in a bubble is this; the walls of a bubble are transparent, and thus everything transpiring outside the bubble is crystal clear."

This topic is closed to new replies.

Advertisement