From f2dc40abdd38d06c03be25c0f175a3a41db28253 Mon Sep 17 00:00:00 2001 From: thefiddler Date: Tue, 29 Apr 2014 08:31:47 +0200 Subject: [PATCH] [OpenTK] Query the driver for VSyncMode getter Otherwise, the user could call Context.SwapInterval directly, causing the vsync property to fall out of sync. --- Source/OpenTK/GameWindow.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index 323f97c..41029bc 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -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; } } -- 2.7.4