Jump to content
  • Advertisement
Sign in to follow this  
stringa

GDI+ Double Buffering...Flicker about every 15 seconds

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

Hello........I am doing a conversion from GDI to GDI+ and I'm having trouble double buffering this app. Basically, I write everything to a Buffer and once that's finished, I DrawImage() to the Window DC. Here's my simple render function. The problem is...It flickers about once every 15 seconds or so. Anyone know how to fix this? // The last DC which is the screen Gdiplus::Graphics g(GetDC(win)); // Fill in the buffer with the board BufferDC->DrawImage(EmptyBoardBitmap,0,0); Gdiplus::Color transparent_black(100,0,0,0); Gdiplus::SolidBrush transparent_brush(transparent_black); BufferDC->FillRectangle( &transparent_brush, BOARD_START_X, BOARD_START_Y, BOARD_SIZE_X * BLOCK_PIXELS_X, BOARD_SIZE_Y * BLOCK_PIXELS_Y); BufferDC->DrawImage(BoardMinusAvatarBitmap, BOARD_START_X, BOARD_START_Y, BOARD_START_X, BOARD_START_Y, BOARD_SIZE_X * BLOCK_PIXELS_X, BOARD_SIZE_Y * BLOCK_PIXELS_Y, Gdiplus::UnitPixel); // Draw the avatar insert_avatar_onto_buffer(BufferDC, theGame); g.DrawImage( BufferBitmap,0,0);

Share this post


Link to post
Share on other sites
Advertisement
I've never used gdiplus, but I'd guess the problem is that the window is being refreshed which causes it to fill it's area with it's background color.

Share this post


Link to post
Share on other sites
Thanks for fixing the problem. I was letting DefWindowProc handle that message. inserted the following in WinProc and now it's working

case WM_ERASEBKND: // something like that

break;


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!