mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-23 07:16:15 +00:00
Fixed: #1145 Implement VSync under Linux
This commit is contained in:
parent
c3af7e3bba
commit
f571a78688
1 changed files with 29 additions and 19 deletions
|
@ -2041,37 +2041,37 @@ void CDriverGL::setSwapVBLInterval(uint interval)
|
||||||
if (!_Initialized)
|
if (!_Initialized)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_Interval = interval;
|
bool res = true;
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
if(_Extensions.WGLEXTSwapControl)
|
if(_Extensions.WGLEXTSwapControl)
|
||||||
{
|
{
|
||||||
nwglSwapIntervalEXT(_Interval);
|
res = nwglSwapIntervalEXT(_Interval) == TRUE;
|
||||||
}
|
}
|
||||||
#elif defined(NL_OS_MAC)
|
#elif defined(NL_OS_MAC)
|
||||||
#elif defined(NL_OS_UNIX)
|
#elif defined(NL_OS_UNIX)
|
||||||
if (_win && _Extensions.GLXEXTSwapControl)
|
if (_win && _Extensions.GLXEXTSwapControl)
|
||||||
{
|
{
|
||||||
if (nglXSwapIntervalEXT(_dpy, _win, interval))
|
res = nglXSwapIntervalEXT(_dpy, _win, interval) == 0;
|
||||||
{
|
|
||||||
nlwarning("Could not set swap interval");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (_Extensions.GLXSGISwapControl)
|
else if (_Extensions.GLXSGISwapControl)
|
||||||
{
|
{
|
||||||
if (nglXSwapIntervalSGI(interval))
|
res = nglXSwapIntervalSGI(interval) == 0;
|
||||||
{
|
|
||||||
nlwarning("Could not set swap interval");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (_Extensions.GLXMESASwapControl)
|
else if (_Extensions.GLXMESASwapControl)
|
||||||
{
|
{
|
||||||
if (nglXSwapIntervalMESA(interval))
|
res = nglXSwapIntervalMESA(interval) == 0;
|
||||||
{
|
|
||||||
nlwarning("Could not set swap interval");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
_Interval = interval;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlwarning("Could not set swap interval");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
@ -2082,12 +2082,22 @@ uint CDriverGL::getSwapVBLInterval()
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
if(_Extensions.WGLEXTSwapControl)
|
if(_Extensions.WGLEXTSwapControl)
|
||||||
{
|
{
|
||||||
return _Interval;
|
return nwglGetSwapIntervalEXT();
|
||||||
}
|
}
|
||||||
else
|
#elif defined(NL_OS_MAC)
|
||||||
return 1;
|
#elif defined(NL_OS_UNIX)
|
||||||
#else
|
if (_win && _Extensions.GLXEXTSwapControl)
|
||||||
return 1;
|
{
|
||||||
|
uint swap, maxSwap;
|
||||||
|
glXQueryDrawable(_dpy, _win, GLX_SWAP_INTERVAL_EXT, &swap);
|
||||||
|
glXQueryDrawable(_dpy, _win, GLX_MAX_SWAP_INTERVAL_EXT, &maxSwap);
|
||||||
|
nlwarning("The swap interval is %u and the max swap interval is %u", swap, maxSwap);
|
||||||
|
return swap;
|
||||||
|
}
|
||||||
|
else if (_Extensions.GLXMESASwapControl)
|
||||||
|
{
|
||||||
|
return nglXGetSwapIntervalMESA();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return _Interval;
|
return _Interval;
|
||||||
|
|
Loading…
Reference in a new issue