From f8ec5ffcd04c9fdd9c82de32114d8284579d96a9 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Fri, 11 Jan 2008 20:37:09 +0000 Subject: [PATCH] Solved context creation on windows. --- Source/OpenTK/GameWindow.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index dfaf8f01..ca2df091 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -129,8 +129,6 @@ namespace OpenTK CreateWindow(mode, title); - glContext = new GLContext(mode, glWindow.WindowInfo); - glContext.CreateContext(); //this.vsync = VSyncMode.Adaptive; this.VSync = VSyncMode.On; } @@ -214,7 +212,7 @@ namespace OpenTK /// Returns the opengl IGLontext associated with the current GameWindow. /// Forces window creation. /// - public IGLContext Context + public GLContext Context { get { @@ -329,7 +327,7 @@ namespace OpenTK { try { - glWindow.CreateWindow(mode); + glWindow.CreateWindow(mode, Context); } catch (ApplicationException expt) { @@ -381,7 +379,11 @@ namespace OpenTK { if (!Exists) { - glWindow.CreateWindow(mode); + glWindow.CreateWindow(mode, glContext); + glContext = new GLContext(mode, glWindow.WindowInfo); + (glContext as IGLContextCreationHack).SetWindowHandle(glWindow.WindowInfo.Handle); + (glContext as IGLContextCreationHack).SelectDisplayMode(mode, glWindow.WindowInfo); + glContext.CreateContext(); this.Title = title; } else @@ -1278,6 +1280,7 @@ namespace OpenTK { if (glWindow != null) { + glContext.Dispose(); glWindow.Dispose(); glWindow = null; }