mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-13 12:05:38 +00:00
Refactored context creation to be done inside the *GLNative classes, instead of the GameWindow class. Should refactor in the next version.
This commit is contained in:
parent
a44747d0c2
commit
33d0193e7f
|
@ -327,7 +327,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
glWindow.CreateWindow(mode, Context);
|
glWindow.CreateWindow(mode, out glContext);
|
||||||
}
|
}
|
||||||
catch (ApplicationException expt)
|
catch (ApplicationException expt)
|
||||||
{
|
{
|
||||||
|
@ -379,9 +379,9 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
if (!Exists)
|
if (!Exists)
|
||||||
{
|
{
|
||||||
glWindow.CreateWindow(mode, glContext);
|
// TODO: This is a hack - reslove in 0.3.15 once and for all!
|
||||||
glContext = new GLContext(mode, glWindow.WindowInfo);
|
// GLContext is created inside the CreateWindow call.
|
||||||
glContext.CreateContext();
|
glWindow.CreateWindow(mode, out glContext);
|
||||||
this.Title = title;
|
this.Title = title;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace OpenTK.Platform
|
||||||
/// </summary>
|
/// </summary>
|
||||||
interface INativeGLWindow : IResizable, IDisposable
|
interface INativeGLWindow : IResizable, IDisposable
|
||||||
{
|
{
|
||||||
void CreateWindow(DisplayMode mode, GLContext context);
|
void CreateWindow(DisplayMode mode, out GLContext context);
|
||||||
void DestroyWindow();
|
void DestroyWindow();
|
||||||
void ProcessEvents();
|
void ProcessEvents();
|
||||||
void PointToClient(ref System.Drawing.Point p);
|
void PointToClient(ref System.Drawing.Point p);
|
||||||
|
|
|
@ -277,9 +277,9 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public void CreateWindow(DisplayMode mode, GLContext context)
|
#region public void CreateWindow(DisplayMode mode, out GLContext context)
|
||||||
|
|
||||||
public void CreateWindow(DisplayMode windowMode, GLContext context)
|
public void CreateWindow(DisplayMode windowMode, out GLContext context)
|
||||||
{
|
{
|
||||||
Debug.Print("Creating native window with mode: {0}", windowMode.ToString());
|
Debug.Print("Creating native window with mode: {0}", windowMode.ToString());
|
||||||
Debug.Indent();
|
Debug.Indent();
|
||||||
|
@ -336,6 +336,9 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
Functions.SetWindowPos(this.Handle, WindowPlacementOptions.TOP, Left, Top, cp.Width, cp.Height, SetWindowPosFlags.SHOWWINDOW);
|
Functions.SetWindowPos(this.Handle, WindowPlacementOptions.TOP, Left, Top, cp.Width, cp.Height, SetWindowPosFlags.SHOWWINDOW);
|
||||||
|
|
||||||
|
context = new GLContext(mode, window);
|
||||||
|
context.CreateContext();
|
||||||
|
|
||||||
Debug.Unindent();
|
Debug.Unindent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -334,7 +334,7 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region public void CreateWindow(DisplayMode mode, GLContext glContext)
|
#region public void CreateWindow(DisplayMode mode, out GLContext glContext)
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens a new render window with the given DisplayMode.
|
/// Opens a new render window with the given DisplayMode.
|
||||||
|
@ -347,7 +347,7 @@ namespace OpenTK.Platform.X11
|
||||||
/// Colormap creation is currently disabled.
|
/// Colormap creation is currently disabled.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void CreateWindow(DisplayMode mode, GLContext glContext)
|
public void CreateWindow(DisplayMode mode, out GLContext glContext)
|
||||||
{
|
{
|
||||||
if (exists)
|
if (exists)
|
||||||
throw new ApplicationException("Render window already exists!");
|
throw new ApplicationException("Render window already exists!");
|
||||||
|
@ -355,8 +355,8 @@ namespace OpenTK.Platform.X11
|
||||||
Debug.Print("Creating GameWindow with mode: {0}", mode != null ? mode.ToString() : "default");
|
Debug.Print("Creating GameWindow with mode: {0}", mode != null ? mode.ToString() : "default");
|
||||||
Debug.Indent();
|
Debug.Indent();
|
||||||
|
|
||||||
//glContext = new X11GLContext(mode, window);
|
glContext = new GLContext(mode, window);
|
||||||
//glContext.PrepareContext(window);
|
(glContext as IGLContextCreationHack).SelectDisplayMode(mode, window);
|
||||||
window.VisualInfo = ((glContext as IGLContextInternal).Info as X11.WindowInfo).VisualInfo;
|
window.VisualInfo = ((glContext as IGLContextInternal).Info as X11.WindowInfo).VisualInfo;
|
||||||
//window.VisualInfo = Marshal.PtrToStructure(Glx.ChooseVisual(window.Display, window.Screen,
|
//window.VisualInfo = Marshal.PtrToStructure(Glx.ChooseVisual(window.Display, window.Screen,
|
||||||
|
|
||||||
|
@ -412,9 +412,7 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
Debug.Print("done! (id: {0})", window.Handle);
|
Debug.Print("done! (id: {0})", window.Handle);
|
||||||
|
|
||||||
//(glContext.Info as X11.WindowInfo).Handle = window.Handle;
|
(glContext as IGLContextCreationHack).SetWindowHandle(window.Handle);
|
||||||
//glContext.CreateContext(true, null);
|
|
||||||
//glContext.MakeCurrent();
|
|
||||||
|
|
||||||
API.MapRaised(window.Display, window.Handle);
|
API.MapRaised(window.Display, window.Handle);
|
||||||
mapped = true;
|
mapped = true;
|
||||||
|
|
Loading…
Reference in a new issue