Explorar o código

checks if vsync is usable (to avoid problems with VM)

bosoni %!s(int64=12) %!d(string=hai) anos
pai
achega
ee5d0159cc
Modificáronse 1 ficheiros con 5 adicións e 3 borrados
  1. 5 3
      gameplay/src/PlatformWindows.cpp

+ 5 - 3
gameplay/src/PlatformWindows.cpp

@@ -760,7 +760,8 @@ bool initializeGL(WindowCreationParams* params)
     }
 
     // Vertical sync.
-    wglSwapIntervalEXT(__vsync ? 1 : 0);
+	if (wglSwapIntervalEXT) wglSwapIntervalEXT(__vsync ? 1 : 0);
+	else __vsync = false;
 
     // Some old graphics cards support EXT_framebuffer_object instead of ARB_framebuffer_object.
     // Patch ARB_framebuffer_object functions to EXT_framebuffer_object ones since semantic is same.
@@ -1073,8 +1074,9 @@ bool Platform::isVsync()
 
 void Platform::setVsync(bool enable)
 {
-     wglSwapIntervalEXT(enable ? 1 : 0);
-    __vsync = enable;
+	__vsync = enable;
+	if (wglSwapIntervalEXT) wglSwapIntervalEXT(enable ? 1 : 0);
+	else __vsync = false;
 }
 
 void Platform::swapBuffers()