mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 17:35:30 +00:00
Add overload to OpenTK.Platform.Utilities.CreateGraphicsContext which takes version number and flag parameters. Deprecate old CreateGraphicsContext methods.
This commit is contained in:
parent
c02b693062
commit
768528ca81
|
@ -214,36 +214,65 @@ namespace OpenTK.Platform
|
|||
|
||||
#endregion
|
||||
|
||||
#region --- Creating an Graphics Context ---
|
||||
#region --- CreateWindowInfo ---
|
||||
#region --- Creating a Graphics Context ---
|
||||
|
||||
/// <summary>
|
||||
/// Creates GraphicsContext and IWindowInfo objects for a WinForms control.
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Creates a Graphics context and for a window or control.
|
||||
/// </summary>
|
||||
/// <param name="mode"></param>
|
||||
///
|
||||
/// <param name="major">Major version number of OpenGL context to create.</param>
|
||||
/// <param name="minor">Minor version number of OpenGL context to create.</param>
|
||||
/// <param name="flags"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="info"></param>
|
||||
public static Graphics.GraphicsContext CreateGraphicsContext(
|
||||
Graphics.GraphicsMode mode, IWindowInfo info,
|
||||
int major, int minor, OpenTK.Graphics.GraphicsContextFlags flags)
|
||||
{
|
||||
Graphics.GraphicsContext context = new Graphics.GraphicsContext(mode, info, major, minor, flags);
|
||||
context.MakeCurrent(info);
|
||||
|
||||
(context as OpenTK.Graphics.IGraphicsContextInternal).LoadAll();
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates GraphicsContext and IWindowInfo objects for a WinForms control.
|
||||
/// </summary>
|
||||
/// <param name="cntrl"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="mode"></param>
|
||||
public static void CreateGraphicsContext(Graphics.GraphicsMode mode, Control cntrl, out Graphics.GraphicsContext context, out IWindowInfo info)
|
||||
{
|
||||
CreateGraphicsContext(mode, cntrl.Handle, out context, out info);
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates GraphicsContext and IWindowInfo objects for a WinForms control.
|
||||
/// </summary>
|
||||
[Obsolete("Create the IWindowInfo object first by calling CreateWindowInfo, then use the CreateGraphicsContext overload which takes major, minor and flags parameters.")]
|
||||
public static void CreateGraphicsContext(Graphics.GraphicsMode mode, Control cntrl,
|
||||
out Graphics.GraphicsContext context, out IWindowInfo info)
|
||||
{
|
||||
CreateGraphicsContext(mode, cntrl.Handle, out context, out info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates GraphicsContext and IWindowInfo objects for a WinForms control.
|
||||
/// </summary>
|
||||
/// <param name="cntrlHandle"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="info"></param>
|
||||
/// <param name="mode"></param>
|
||||
public static void CreateGraphicsContext(Graphics.GraphicsMode mode, IntPtr cntrlHandle, out Graphics.GraphicsContext context, out IWindowInfo info)
|
||||
{
|
||||
info = CreateWindowInfo(mode, cntrlHandle);
|
||||
[Obsolete("Create the IWindowInfo object first by calling CreateWindowInfo, then use the CreateGraphicsContext overload which takes major, minor and flags parameters.")]
|
||||
public static void CreateGraphicsContext(Graphics.GraphicsMode mode, IntPtr cntrlHandle,
|
||||
out Graphics.GraphicsContext context, out IWindowInfo info)
|
||||
{
|
||||
info = CreateWindowInfo(mode, cntrlHandle);
|
||||
|
||||
context = new Graphics.GraphicsContext(mode, info);
|
||||
context.MakeCurrent(info);
|
||||
|
||||
(context as OpenTK.Graphics.IGraphicsContextInternal).LoadAll();
|
||||
}
|
||||
}
|
||||
|
||||
#region --- CreateWindowInfo ---
|
||||
|
||||
/// <summary>
|
||||
/// Creates an object which implements the IWindowInfo interface for the platform
|
||||
/// currently running on. This will create a handle for the control, so it is not
|
||||
|
|
Loading…
Reference in a new issue