mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-12 05:25:35 +00:00
Added VSync property to IGLContext.
This commit is contained in:
parent
29b6f1660e
commit
4e421d30fb
|
@ -153,6 +153,15 @@ namespace OpenTK
|
||||||
return implementation.GetDisplayModes();
|
return implementation.GetDisplayModes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether VSync is enabled.
|
||||||
|
/// </summary>
|
||||||
|
public bool VSync
|
||||||
|
{
|
||||||
|
get { return implementation.VSync; }
|
||||||
|
set { implementation.VSync = value; }
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IDisposable Members
|
#region IDisposable Members
|
||||||
|
|
|
@ -34,6 +34,8 @@ namespace OpenTK.Platform
|
||||||
public IntPtr GetAddress(string function) { return IntPtr.Zero; }
|
public IntPtr GetAddress(string function) { return IntPtr.Zero; }
|
||||||
public IEnumerable<DisplayMode> GetDisplayModes() { return null; }
|
public IEnumerable<DisplayMode> GetDisplayModes() { return null; }
|
||||||
|
|
||||||
|
public bool VSync { get { return false; } set { } }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region --- IDisposable Members ---
|
#region --- IDisposable Members ---
|
||||||
|
|
|
@ -87,5 +87,10 @@ namespace OpenTK.Platform
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>An IEnumerable containing all supported display modes.</returns>
|
/// <returns>An IEnumerable containing all supported display modes.</returns>
|
||||||
IEnumerable<DisplayMode> GetDisplayModes();
|
IEnumerable<DisplayMode> GetDisplayModes();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether VSyncing is enabled.
|
||||||
|
/// </summary>
|
||||||
|
bool VSync { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ namespace OpenTK.Platform.Windows
|
||||||
private WindowInfo windowInfo = new WindowInfo();
|
private WindowInfo windowInfo = new WindowInfo();
|
||||||
|
|
||||||
private DisplayMode mode;
|
private DisplayMode mode;
|
||||||
|
private bool vsync_supported;
|
||||||
|
|
||||||
private bool disposed;
|
private bool disposed;
|
||||||
|
|
||||||
|
@ -232,6 +233,11 @@ namespace OpenTK.Platform.Windows
|
||||||
Wgl.Imports.MakeCurrent(deviceContext, renderContext);
|
Wgl.Imports.MakeCurrent(deviceContext, renderContext);
|
||||||
Wgl.LoadAll();
|
Wgl.LoadAll();
|
||||||
|
|
||||||
|
vsync_supported =
|
||||||
|
(Wgl.ARB.SupportsExtension(this.deviceContext, "WGL_EXT_swap_control") ||
|
||||||
|
Wgl.EXT.SupportsExtension(this.deviceContext, "WGL_EXT_swap_control")) &&
|
||||||
|
Wgl.Load("wglGetSwapIntervalEXT") && Wgl.Load("wglSwapIntervalEXT");
|
||||||
|
|
||||||
if (source != null)
|
if (source != null)
|
||||||
{
|
{
|
||||||
Debug.Print("Sharing state with context {0}", (source as WinGLContext).Context);
|
Debug.Print("Sharing state with context {0}", (source as WinGLContext).Context);
|
||||||
|
@ -322,6 +328,19 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public bool VSync
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
//return vsync != 0;
|
||||||
|
return Wgl.EXT.GetSwapInterval() != 0;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Wgl.EXT.SwapInterval(value ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region --- IDisposable Members ---
|
#region --- IDisposable Members ---
|
||||||
|
|
|
@ -267,6 +267,18 @@ namespace OpenTK.Platform.X11
|
||||||
throw new Exception("The method or operation is not implemented.");
|
throw new Exception("The method or operation is not implemented.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool VSync
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region --- IDisposable Members ---
|
#region --- IDisposable Members ---
|
||||||
|
|
Loading…
Reference in a new issue