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
e8cd2dc6c5
commit
4a5b8e81d8
4 changed files with 15 additions and 14 deletions
|
@ -327,7 +327,7 @@ namespace OpenTK
|
|||
{
|
||||
try
|
||||
{
|
||||
glWindow.CreateWindow(mode, Context);
|
||||
glWindow.CreateWindow(mode, out glContext);
|
||||
}
|
||||
catch (ApplicationException expt)
|
||||
{
|
||||
|
@ -379,9 +379,9 @@ namespace OpenTK
|
|||
{
|
||||
if (!Exists)
|
||||
{
|
||||
glWindow.CreateWindow(mode, glContext);
|
||||
glContext = new GLContext(mode, glWindow.WindowInfo);
|
||||
glContext.CreateContext();
|
||||
// TODO: This is a hack - reslove in 0.3.15 once and for all!
|
||||
// GLContext is created inside the CreateWindow call.
|
||||
glWindow.CreateWindow(mode, out glContext);
|
||||
this.Title = title;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace OpenTK.Platform
|
|||
/// </summary>
|
||||
interface INativeGLWindow : IResizable, IDisposable
|
||||
{
|
||||
void CreateWindow(DisplayMode mode, GLContext context);
|
||||
void CreateWindow(DisplayMode mode, out GLContext context);
|
||||
void DestroyWindow();
|
||||
void ProcessEvents();
|
||||
void PointToClient(ref System.Drawing.Point p);
|
||||
|
|
|
@ -277,9 +277,9 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
#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.Indent();
|
||||
|
@ -336,6 +336,9 @@ namespace OpenTK.Platform.Windows
|
|||
|
||||
Functions.SetWindowPos(this.Handle, WindowPlacementOptions.TOP, Left, Top, cp.Width, cp.Height, SetWindowPosFlags.SHOWWINDOW);
|
||||
|
||||
context = new GLContext(mode, window);
|
||||
context.CreateContext();
|
||||
|
||||
Debug.Unindent();
|
||||
}
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ namespace OpenTK.Platform.X11
|
|||
|
||||
#endregion
|
||||
|
||||
#region public void CreateWindow(DisplayMode mode, GLContext glContext)
|
||||
#region public void CreateWindow(DisplayMode mode, out GLContext glContext)
|
||||
|
||||
/// <summary>
|
||||
/// Opens a new render window with the given DisplayMode.
|
||||
|
@ -347,7 +347,7 @@ namespace OpenTK.Platform.X11
|
|||
/// Colormap creation is currently disabled.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public void CreateWindow(DisplayMode mode, GLContext glContext)
|
||||
public void CreateWindow(DisplayMode mode, out GLContext glContext)
|
||||
{
|
||||
if (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.Indent();
|
||||
|
||||
//glContext = new X11GLContext(mode, window);
|
||||
//glContext.PrepareContext(window);
|
||||
glContext = new GLContext(mode, window);
|
||||
(glContext as IGLContextCreationHack).SelectDisplayMode(mode, window);
|
||||
window.VisualInfo = ((glContext as IGLContextInternal).Info as X11.WindowInfo).VisualInfo;
|
||||
//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);
|
||||
|
||||
//(glContext.Info as X11.WindowInfo).Handle = window.Handle;
|
||||
//glContext.CreateContext(true, null);
|
||||
//glContext.MakeCurrent();
|
||||
(glContext as IGLContextCreationHack).SetWindowHandle(window.Handle);
|
||||
|
||||
API.MapRaised(window.Display, window.Handle);
|
||||
mapped = true;
|
||||
|
|
Loading…
Reference in a new issue