mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
OpenGL vsync fixes.
This commit is contained in:
parent
38bf2b8175
commit
415f4a046e
7 changed files with 47 additions and 4 deletions
|
|
@ -2,11 +2,32 @@
|
|||
|
||||
#include "platform/platformGL.h"
|
||||
#include "gfx/gl/tGL/tWGL.h"
|
||||
#include "gfx/gl/gfxGLUtils.h"
|
||||
|
||||
void PlatformGL::setVSync(const int i)
|
||||
{
|
||||
if (gglHasWExtension(wglGetCurrentDC(), EXT_swap_control))
|
||||
if (gglHasWExtension(EXT_swap_control))
|
||||
{
|
||||
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
|
||||
wglSwapIntervalEXT(i);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue