Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

lost hope

CreateCompatibleBitmap Question

This topic is 5748 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!