So I was writing a simple 2D game with OpenGL and SDL and had this problem when there was awful tearing when running in windowed mode (even though I explicitly asked SDL_SetVideoMode to use double buffering). Didn't worry about it all too much because most of the time the game grabs the entire screen, windowed mode is just for debugging.

Anyway, yesterday I updated my nVidia drivers and tearing disappeared, the game runs smooth and looks nice in windowed mode too. I can see how the problem may be in the graphics driver, but this leads to a question.

Obviously, professional game developers have to deal with a lot of different hardware/software configurations. What are the techniques they use to make sure the game looks the roughly the same on different graphics cards or even the same model of graphics card, but with different driver versions?


2 Answers 2


There are no techniques beyond keeping the differences in mind and always looking out for more (testing often on various hardware/software configurations).

As for the tearing problem, it's all about VSync. The driver update probably had it turned on by default. Double buffering is just the act of swapping buffers to avoid waiting while the display is redrawn. Tearing occurs exactly because the buffer swap occurs in the middle of the screen repaint operation.

To enable VSync in OpenGL, you need to use this extension in Windows, specifically the "wglSwapIntervalEXT" function, interval=1 would mean that buffer swap will wait for repainting of one frame, interval=2 means 2 frames etc. And interval=0 is the default "do not wait unless driver thinks differently" setting. Frame count per second equals your monitor's refresh rate setting.

X Window system (Linux, Mac) needs this extension.

P.S. You can also try SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1); Some say it doesn't work in windowed mode though.

  • \$\begingroup\$ This shouldn't be done programmatically -- it is a user setting (whether or not the user wants to have VSYNC on or not), you should probably respect the user's config settings. \$\endgroup\$
    – bobobobo
    Oct 17, 2012 at 18:37
  • \$\begingroup\$ It's possible (and highly suggested, just not in the answer above) to add an option to enable/disable VSync in the game. By the way, display driver control panels offer the possibility to override all application settings. So there's no harm done even if there's no such option added. \$\endgroup\$
    – snake5
    Oct 17, 2012 at 18:42

Stuff looks the same on different drivers due to DirectX and OpenGL. That was the point of those API's, to abstract the graphics device from the programmer so he doesn't have to worry about it.

The tearing you see is likely your VSYNC setting, being set to OFF, and it's plausible that installing the new driver set it back to ON.

enter image description here

If your VSYNC setting was not set to synchronize the graphics device draw with the refresh interval, then tearing can occur.


You must log in to answer this question.