mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-24 01:45:37 +00:00
Moved and renamed OpenTK.GLContext to OpenTK.Graphics.GraphicsContext.
This commit is contained in:
parent
210abb6ab6
commit
5b9991cba3
|
@ -20,7 +20,7 @@ namespace Examples.Tests
|
|||
{
|
||||
public class S01_Call_Performance : IExample
|
||||
{
|
||||
GLContext context;
|
||||
GraphicsContext context;
|
||||
const int num_calls = 1000000;
|
||||
float[] v = new float[] { 0.0f, 0.0f };
|
||||
public static int dummy_variable = 0;
|
||||
|
@ -29,7 +29,7 @@ namespace Examples.Tests
|
|||
{
|
||||
using (Form f = new Form())
|
||||
{
|
||||
context = new GLContext(new OpenTK.DisplayMode(), new OpenTK.Platform.WindowInfo(f));
|
||||
context = new GraphicsContext(new OpenTK.DisplayMode(), new OpenTK.Platform.WindowInfo(f));
|
||||
context.CreateContext();
|
||||
|
||||
Trace.WriteLine(String.Format("Number of calls: {0}", num_calls));
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace Examples.WinForms
|
|||
public partial class W03_Extensions : Form
|
||||
{
|
||||
//GLControl glControl = new GLControl();
|
||||
GLContext context;
|
||||
GraphicsContext context;
|
||||
Type glClass;
|
||||
Type delegatesClass;
|
||||
Type importsClass;
|
||||
|
@ -48,7 +48,7 @@ namespace Examples.WinForms
|
|||
{
|
||||
Application.Idle -= StartAsync;
|
||||
|
||||
context = new GLContext(new DisplayMode(), new OpenTK.Platform.WindowInfo(this));
|
||||
context = new GraphicsContext(new DisplayMode(), new OpenTK.Platform.WindowInfo(this));
|
||||
context.CreateContext();
|
||||
|
||||
//while (!glControl.Created)
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace OpenTK
|
|||
#region public class ContextExistsException : ApplicationException
|
||||
|
||||
/// <summary>
|
||||
/// This exception is thrown when a GLContext property cannot be changed after creation.
|
||||
/// This exception is thrown when a GraphicsContext property cannot be changed after creation.
|
||||
/// </summary>
|
||||
public class ContextExistsException : ApplicationException
|
||||
{
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace OpenTK
|
|||
#region public IGraphicsContext Context
|
||||
|
||||
/// <summary>
|
||||
/// Gets an interface to the underlying GLContext used by this GLControl.
|
||||
/// Gets an interface to the underlying GraphicsContext used by this GLControl.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
public IGraphicsContext Context
|
||||
|
@ -145,10 +145,10 @@ namespace OpenTK
|
|||
// TODO: Remove for 0.3.15
|
||||
|
||||
/// <summary>
|
||||
/// Gets the DisplayMode of the GLContext attached to this GLControl.
|
||||
/// Gets the DisplayMode of the GraphicsContext attached to this GLControl.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// You cannot change the DisplayMode of an existing GLContext.
|
||||
/// You cannot change the DisplayMode of an existing GraphicsContext.
|
||||
/// </remarks>
|
||||
public DisplayMode Mode
|
||||
{
|
||||
|
@ -189,7 +189,7 @@ namespace OpenTK
|
|||
#region public void CreateContext()
|
||||
|
||||
/// <summary>
|
||||
/// Creates a GLContext and attaches it to this GLControl.
|
||||
/// Creates a GraphicsContext and attaches it to this GLControl.
|
||||
/// </summary>
|
||||
public void CreateContext()
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ namespace OpenTK
|
|||
// have a different colordepth from the parent. To combat this, we do not set a
|
||||
// specific depth for the DisplayMode - we let the driver select one instead.
|
||||
//display_mode.ColorFormat = new ColorMode(0);
|
||||
context = new GLContext(display_mode, info);
|
||||
context = new GraphicsContext(display_mode, info);
|
||||
idle = new PlatformIdle(info);
|
||||
}
|
||||
else
|
||||
|
@ -218,9 +218,9 @@ namespace OpenTK
|
|||
#region public void DestroyContext()
|
||||
|
||||
/// <summary>
|
||||
/// Destroys the GLContext attached to this GLControl.
|
||||
/// Destroys the GraphicsContext attached to this GLControl.
|
||||
/// </summary>
|
||||
/// <exception cref="NullReferenceException">Occurs when no GLContext is attached.</exception>
|
||||
/// <exception cref="NullReferenceException">Occurs when no GraphicsContext is attached.</exception>
|
||||
public void DestroyContext()
|
||||
{
|
||||
Context.Dispose();
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace OpenTK
|
|||
|
||||
glWindow.Destroy += glWindow_Destroy;
|
||||
|
||||
// TODO: GLContext is created inside this call.
|
||||
// TODO: GraphicsContext is created inside this call.
|
||||
glWindow.CreateWindow(width, height, format, out glContext);
|
||||
this.Title = title;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace OpenTK.Graphics
|
|||
/// <summary>
|
||||
/// Represents and provides methods to manipulate an OpenGL render context.
|
||||
/// </summary>
|
||||
public sealed class GLContext : IGraphicsContext, IGLContextInternal, IGLContextCreationHack
|
||||
public sealed class GraphicsContext : IGraphicsContext, IGLContextInternal, IGLContextCreationHack
|
||||
{
|
||||
IGraphicsContext implementation; // The actual render context implementation for the underlying platform.
|
||||
List<IDisposable> dispose_queue = new List<IDisposable>();
|
||||
|
@ -26,14 +26,14 @@ namespace OpenTK.Graphics
|
|||
static Dictionary<ContextHandle, WeakReference> available_contexts =
|
||||
new Dictionary<ContextHandle, WeakReference>(); // Contains all available OpenGL contexts.
|
||||
|
||||
#region public GLContext(DisplayMode mode, IWindowInfo window)
|
||||
#region public GraphicsContext(DisplayMode mode, IWindowInfo window)
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new GLContext with the specified DisplayMode, and bound to the specified IWindowInfo.
|
||||
/// Constructs a new GraphicsContext with the specified DisplayMode, and bound to the specified IWindowInfo.
|
||||
/// </summary>
|
||||
/// <param name="mode"></param>
|
||||
/// <param name="window"></param>
|
||||
public GLContext(DisplayMode mode, IWindowInfo window)
|
||||
public GraphicsContext(DisplayMode mode, IWindowInfo window)
|
||||
{
|
||||
//if (available_contexts.Count == 0)
|
||||
// available_contexts.Add(IntPtr.Zero, new WeakReference(null));
|
||||
|
@ -58,14 +58,14 @@ namespace OpenTK.Graphics
|
|||
|
||||
(this as IGLContextCreationHack).SetWindowHandle(window.Handle);
|
||||
(this as IGLContextCreationHack).SelectDisplayMode(mode, window);
|
||||
if (GLContext.ShareContexts)
|
||||
if (GraphicsContext.ShareContexts)
|
||||
{
|
||||
lock (context_lock)
|
||||
{
|
||||
// A small hack to create a shared context with the first available context.
|
||||
foreach (WeakReference r in GLContext.available_contexts.Values)
|
||||
foreach (WeakReference r in GraphicsContext.available_contexts.Values)
|
||||
{
|
||||
this.CreateContext(true, (GLContext)r.Target);
|
||||
this.CreateContext(true, (GraphicsContext)r.Target);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -102,15 +102,15 @@ namespace OpenTK.Graphics
|
|||
/// <summary>
|
||||
/// Gets or sets the current GraphicsContext in the calling thread.
|
||||
/// </summary>
|
||||
public static GLContext CurrentContext
|
||||
public static GraphicsContext CurrentContext
|
||||
{
|
||||
get
|
||||
{
|
||||
if (available_contexts.Count > 0)
|
||||
return (GLContext)available_contexts[GetCurrentContext()].Target;
|
||||
//return (GLContext)available_contexts[((IGLContextInternal)available_contexts[IntPtr.Zero].Target).GetCurrentContext()].Target;
|
||||
return (GraphicsContext)available_contexts[GetCurrentContext()].Target;
|
||||
//return (GraphicsContext)available_contexts[((IGLContextInternal)available_contexts[IntPtr.Zero].Target).GetCurrentContext()].Target;
|
||||
return null;
|
||||
//return (GLContext)available_contexts[StaticGetCurrentContext().ToInt64()].Target;
|
||||
//return (GraphicsContext)available_contexts[StaticGetCurrentContext().ToInt64()].Target;
|
||||
}
|
||||
set
|
||||
{
|
||||
|
@ -334,7 +334,7 @@ namespace OpenTK.Graphics
|
|||
#region --- IDisposable Members ---
|
||||
|
||||
/// <summary>
|
||||
/// Disposes of the GLContext.
|
||||
/// Disposes of the GraphicsContext.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
|
@ -355,7 +355,7 @@ namespace OpenTK.Graphics
|
|||
}
|
||||
}
|
||||
|
||||
~GLContext()
|
||||
~GraphicsContext()
|
||||
{
|
||||
this.Dispose(false);
|
||||
}
|
||||
|
|
|
@ -192,8 +192,8 @@ namespace OpenTK.OpenGL
|
|||
/// </remarks>
|
||||
public static void LoadAll()
|
||||
{
|
||||
//TODO: Route GameWindow context creation through GLContext.
|
||||
//if (GLContext.CurrentContext == null)
|
||||
//TODO: Route GameWindow context creation through GraphicsContext.
|
||||
//if (GraphicsContext.CurrentContext == null)
|
||||
// throw new InvalidOperationException("You must create an OpenGL context before using the GL class.");
|
||||
|
||||
OpenTK.Platform.Utilities.LoadExtensions(glClass);
|
||||
|
|
|
@ -46,12 +46,12 @@ namespace OpenTK.Platform
|
|||
|
||||
public void RegisterForDisposal(IDisposable resource)
|
||||
{
|
||||
throw new NotImplementedException("Use the general GLContext class instead.");
|
||||
throw new NotImplementedException("Use the general GraphicsContext class instead.");
|
||||
}
|
||||
|
||||
public void DisposeResources()
|
||||
{
|
||||
throw new NotImplementedException("Use the general GLContext class instead.");
|
||||
throw new NotImplementedException("Use the general GraphicsContext class instead.");
|
||||
}
|
||||
|
||||
public IntPtr GetAddress(string function) { return IntPtr.Zero; }
|
||||
|
|
|
@ -42,8 +42,8 @@ namespace OpenTK.Platform.Windows
|
|||
static WinGLContext()
|
||||
{
|
||||
// Set the GetCurrentContext implementation.
|
||||
if (GLContext.GetCurrentContext == null)
|
||||
GLContext.GetCurrentContext = WinGLContext.GetCurrentContext;
|
||||
if (GraphicsContext.GetCurrentContext == null)
|
||||
GraphicsContext.GetCurrentContext = WinGLContext.GetCurrentContext;
|
||||
}
|
||||
|
||||
public WinGLContext()
|
||||
|
@ -218,7 +218,7 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
void IGLContextInternal.RegisterForDisposal(IDisposable resource)
|
||||
{
|
||||
throw new NotSupportedException("Use OpenTK.GLContext instead.");
|
||||
throw new NotSupportedException("Use OpenTK.GraphicsContext instead.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -227,7 +227,7 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
void IGLContextInternal.DisposeResources()
|
||||
{
|
||||
throw new NotSupportedException("Use OpenTK.GLContext instead.");
|
||||
throw new NotSupportedException("Use OpenTK.GraphicsContext instead.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -367,7 +367,7 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
Functions.SetWindowPos(this.Handle, WindowPlacementOptions.TOP, Left, Top, cp.Width, cp.Height, SetWindowPosFlags.SHOWWINDOW);
|
||||
|
||||
//context = new GLContext(mode, window);
|
||||
//context = new GraphicsContext(mode, window);
|
||||
//context.CreateContext();
|
||||
|
||||
context = new WinGLContext();
|
||||
|
|
|
@ -35,8 +35,8 @@ namespace OpenTK.Platform.X11
|
|||
static X11GLContext()
|
||||
{
|
||||
// Set the GetCurrentContext implementation.
|
||||
if (GLContext.GetCurrentContext == null)
|
||||
GLContext.GetCurrentContext = X11GLContext.GetCurrentContext;
|
||||
if (GraphicsContext.GetCurrentContext == null)
|
||||
GraphicsContext.GetCurrentContext = X11GLContext.GetCurrentContext;
|
||||
}
|
||||
|
||||
/// <private />
|
||||
|
@ -302,12 +302,12 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
public void RegisterForDisposal(IDisposable resource)
|
||||
{
|
||||
throw new NotSupportedException("Use OpenTK.GLContext instead.");
|
||||
throw new NotSupportedException("Use OpenTK.GraphicsContext instead.");
|
||||
}
|
||||
|
||||
public void DisposeResources()
|
||||
{
|
||||
throw new NotSupportedException("Use OpenTK.GLContext instead.");
|
||||
throw new NotSupportedException("Use OpenTK.GraphicsContext instead.");
|
||||
}
|
||||
|
||||
public IEnumerable<DisplayMode> GetDisplayModes()
|
||||
|
|
|
@ -405,8 +405,8 @@ namespace OpenTK.Platform.X11
|
|||
glContext = new X11GLContext();
|
||||
(glContext as IGLContextCreationHack).SelectDisplayMode(mode, window);
|
||||
if (glContext == null)
|
||||
throw new ApplicationException("Could not create GLContext");
|
||||
Debug.Print("Created GLContext");
|
||||
throw new ApplicationException("Could not create GraphicsContext");
|
||||
Debug.Print("Created GraphicsContext");
|
||||
window.VisualInfo = ((X11.WindowInfo)((IGLContextInternal)glContext).Info).VisualInfo;
|
||||
//window.VisualInfo = Marshal.PtrToStructure(Glx.ChooseVisual(window.Display, window.Screen,
|
||||
|
||||
|
|
Loading…
Reference in a new issue