Handmade Hero»Forums»Code
14 posts
Windows 10 requires double buffering
Hey guys, I'm currently on day 241 and I ran into a problem. Sometime earlier, when Casey was doing the OpenGL setup code, he disabled PFD_DOUBLEBUFFERING since it interfered with OBS. I had this flag enabled on the code I'm writing and I decided to disable it to see what the frame rates looked like. I found that the fade in stopped working and the screen was permanently set to black. I disabled the fade in stuff and verified that the game window was in fact completely black. The frames in the background where still running and input was being sent to the game so I assume this is a OpenGL/Windows bug. I looked at what the flags for my SuggestedPixelFormat looked like and the only two flags set were PFD_SUPPORT_OPENGL and PFD_DRAW_TO_WINDOW. Whats odd is the moment I enable PFD_DOUBLEBUFFER, everything starts working again with VSYNC permanently on. I looked online and couldn't find anyone else having this problem. Also, the only differences between the SuggestedPixelFormat flags when double buffering is enabled are PDF_TYPE_COLORINDEX and PFD_SWAP_COPY (swap copy has to do with double buffering and when color index is enabled without double buffering, it doesn't do anything). I'm running Win10 which might be the culprit here but I was wondering, would anyone know how to get the code to run without double buffering enabled on windows 10?
Mārtiņš Možeiko
2561 posts / 2 projects
Windows 10 requires double buffering
Edited by Mārtiņš Možeiko on
There actually isn't any reason to not use double buffering. You pretty much always should want to have double buffering enabled.
But I have no idea why single buffering wouldn't work for you. Could be Windows thing, could be driver thing.
14 posts
Windows 10 requires double buffering
The thing is, when double buffering is enabled, the game is vsynced which isn't something that you would want to have required for your game. I guess if double buffering is required, thats fine but for whatever reason, when double buffering is on, so is vsync (before we actually did the vsync episode). Also, I updated my nvidia drivers but no change.
14 posts
Windows 10 requires double buffering
The thing is, when double buffering is enabled, the game is vsynced which isn't something that you would want to have required for your game. I guess if double buffering is required, thats fine but for whatever reason, when double buffering is on, so is vsync (before we actually did the vsync episode). Also, I updated my nvidia drivers but no change.
Mārtiņš Možeiko
2561 posts / 2 projects
Windows 10 requires double buffering
I actually want my games always to be vsync'ed. I hate tearing.
But there are more reasons - if I'm playing game on laptop I want vsync because I don't want game to use 100% CPU because that makes laptop to heat up and drain battery faster.