From 876b5139ef4ffc4ff2a279d0473c3ac17b506344 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Mon, 14 Jan 2008 22:38:09 +0000 Subject: [PATCH] Fixed GLContext creation on Windows. --- Source/OpenTK/GLContext.cs | 3 +++ Source/OpenTK/GLControl.cs | 2 ++ Source/OpenTK/GameWindow.cs | 8 ++------ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/OpenTK/GLContext.cs b/Source/OpenTK/GLContext.cs index ad2c4d8d..f9f94080 100644 --- a/Source/OpenTK/GLContext.cs +++ b/Source/OpenTK/GLContext.cs @@ -57,6 +57,9 @@ namespace OpenTK default: throw new PlatformNotSupportedException("Your platform is not supported currently. Please, refer to http://www.opentk.com for more information."); } + + (this as IGLContextCreationHack).SetWindowHandle(window.Handle); + (this as IGLContextCreationHack).SelectDisplayMode(mode, window); } #endregion diff --git a/Source/OpenTK/GLControl.cs b/Source/OpenTK/GLControl.cs index 3bdd6052..f147f5c2 100644 --- a/Source/OpenTK/GLControl.cs +++ b/Source/OpenTK/GLControl.cs @@ -203,6 +203,8 @@ namespace OpenTK // specific depth for the DisplayMode - we let the driver select one instead. display_mode.Color = new ColorMode(0); context = new GLContext(display_mode, info); + (context as IGLContextCreationHack).SetWindowHandle(info.Handle); + (context as IGLContextCreationHack).SelectDisplayMode(display_mode, info); context.CreateContext(true, null); idle = new PlatformIdle(info); } diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index ca2df091..787a24d0 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -125,8 +125,6 @@ namespace OpenTK "Your platform is not supported currently. Please, refer to http://opentk.sourceforge.net for more information."); } - glWindow.Destroy += new DestroyEvent(glWindow_Destroy); - CreateWindow(mode, title); //this.vsync = VSyncMode.Adaptive; @@ -381,8 +379,6 @@ namespace OpenTK { 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; } @@ -1221,7 +1217,7 @@ namespace OpenTK } */ #endregion - +#if false // TODO: 0.3.15 (Linux support missing) #region PointToClient /// @@ -1251,7 +1247,7 @@ namespace OpenTK } #endregion - +#endif #region --- IDisposable Members --- ///