Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[OpenTK] Query the driver for VSyncMode getter

Otherwise, the user could call Context.SwapInterval directly, causing
the vsync property to fall out of sync.
  • Loading branch information...
commit f2dc40abdd38d06c03be25c0f175a3a41db28253 1 parent 3da459b
@thefiddler thefiddler authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 Source/OpenTK/GameWindow.cs
View
16 Source/OpenTK/GameWindow.cs
@@ -98,8 +98,6 @@ public class GameWindow : NativeWindow, IGameWindow, IDisposable
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 @@ public VSyncMode VSync
{
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 @@ public VSyncMode VSync
Context.SwapInterval = -1;
break;
}
- vsync = value;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.