Torque3D/Engine/source/platformWin32/WinPlatformGL.cpp

36 lines
802 B
C++
Raw Normal View History

2014-11-08 16:41:17 +00:00
#if defined(TORQUE_OPENGL) && !defined(TORQUE_SDL)
#include "platform/platformGL.h"
#include "gfx/gl/tGL/tWGL.h"
2016-12-23 03:59:55 +00:00
#include "gfx/gl/gfxGLUtils.h"
2014-11-08 16:41:17 +00:00
void PlatformGL::setVSync(const int i)
{
2016-12-23 03:59:55 +00:00
if (gglHasWExtension(EXT_swap_control))
2016-03-25 17:41:38 +00:00
{
2016-12-23 03:59:55 +00:00
PRESERVE_FRAMEBUFFER();
// NVidia needs to have the default framebuffer bound or the vsync calls fail
glBindFramebuffer(GL_FRAMEBUFFER, 0);
if (gglHasWExtension(EXT_swap_control_tear))
{
if (i == 1 || i == -1)
{
BOOL ret = wglSwapIntervalEXT(-1);
if (!ret)
wglSwapIntervalEXT(1);
}
else
{
wglSwapIntervalEXT(i);
}
return;
}
//fallback with no EXT_swap_control_tear
2016-03-25 17:41:38 +00:00
wglSwapIntervalEXT(i);
}
2014-11-08 16:41:17 +00:00
}
2014-12-06 19:55:43 +00:00
#endif