Jump to content
  • Advertisement

Archived

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

Miso

double buffering in Windows question

This topic is 5425 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

Hi all, I would like to implement double buffering in Windows. This is what I have so far: a mainWindow with a device context a bitmap with a device context I would then BitBlt the bitmap to the mainWindow each time I receive a WM_PAINT message. The way I change the contents of the bitmap is following: I have a buffer with r,g,b information in memory and just before the bitBlt I copy the color information to the bitmap using SetBitmapBits(...) My question is if there is a way to modify the bitmap color bits direcly in memory, without having to first modify it in the buffer, then copy to bitmap, and then bitBlt to mainWindow. Thanks for help.

Share this post


Link to post
Share on other sites
Advertisement
I believe you can use SetDIBitsToDevice to blit directly from your buffer to the DC.

Alternatively, you could use CreateDIBSection to create the bitmap, and then modify the bitmap directly through the pointer it gives you.


:wq!

Share this post


Link to post
Share on other sites
My solution is to create a window and its DC. Then create a BITMAPINFO with the needed parameters, which you have to use in combination with SetDIBitsToDevice. Using this function you can directly copy your buffer to the DC.

Greets,
André

Share this post


Link to post
Share on other sites

  • 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!