[OpenTK] Query the driver for VSyncMode getter

Otherwise, the user could call Context.SwapInterval directly, causing
the vsync property to fall out of sync.
This commit is contained in:
thefiddler 2014-04-29 08:31:47 +02:00
parent 3da459b316
commit f2dc40abdd

View file

@ -98,8 +98,6 @@ namespace OpenTK
bool is_running_slowly; // true, when UpdatePeriod cannot reach TargetUpdatePeriod
VSyncMode vsync;
FrameEventArgs update_args = new FrameEventArgs();
FrameEventArgs render_args = new FrameEventArgs();
@ -884,7 +882,18 @@ namespace OpenTK
{
EnsureUndisposed();
GraphicsContext.Assert();
return vsync;
if (Context.SwapInterval < 0)
{
return VSyncMode.Adaptive;
}
else if (Context.SwapInterval == 0)
{
return VSyncMode.Off;
}
else
{
return VSyncMode.On;
}
}
set
{
@ -904,7 +913,6 @@ namespace OpenTK
Context.SwapInterval = -1;
break;
}
vsync = value;
}
}