Black Bar on right and bottom and double buffer

There is a black bar on both the right side and(or) the bottom side of my view window if the background of the view window is white and OnSize is called to maximize the window.

To solve the problem, someone suggest me to create a memory device context, and create a bitmap, then choose this bitmap into the memory dc. All we draw is on the memory dc. When drawing work is done, we copy it back to the screen dc.

Now another problem happens. It seens in function SetPixelFormat, the handle of the memory dc does not works well with the case that PFD_DOUBLEBUFFER flag is set. In other words, function SetPixelFormat fails if flag PFD_DOUBLEBUFFER is set. Any one encountered the problem before? Any suggestions? Thanks a lot!

Hi !

Well, it’s not very useful to doublebuffer the image in memory, it’s not visible anyway so you don’t need it, you blit the image yourself…

Using an off screen image like this and then blit it yourself is pretty slow compared to normal rendering by the way.


Rendering in a bitmap and then blitting to screen is the official workaround from Microsoft to fix the bug. The black border is a bug in the Microsoft implementation of opengl32.dll. If you use hardware accelleration you won’t see the border.