WinPlatformGL.cpp
Engine/source/platformWin32/WinPlatformGL.cpp
Detailed Description
1 2#if defined(TORQUE_OPENGL) && !defined(TORQUE_SDL) 3 4#include "platform/platformGL.h" 5#include "gfx/gl/tGL/tWGL.h" 6#include "gfx/gl/gfxGLUtils.h" 7 8void PlatformGL::setVSync(const int i) 9{ 10 if (gglHasWExtension(EXT_swap_control)) 11 { 12 PRESERVE_FRAMEBUFFER(); 13 // NVidia needs to have the default framebuffer bound or the vsync calls fail 14 glBindFramebuffer(GL_FRAMEBUFFER, 0); 15 16 if (gglHasWExtension(EXT_swap_control_tear)) 17 { 18 if (i == 1 || i == -1) 19 { 20 BOOL ret = wglSwapIntervalEXT(-1); 21 22 if (!ret) 23 wglSwapIntervalEXT(1); 24 } 25 else 26 { 27 wglSwapIntervalEXT(i); 28 } 29 return; 30 } 31 //fallback with no EXT_swap_control_tear 32 wglSwapIntervalEXT(i); 33 } 34} 35 36#endif 37