From 2968ab984248d3882bb05e0345c06dcfb30770c7 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sat, 20 Oct 2007 10:28:02 +0000 Subject: [PATCH] The Resize event is now fired before the Load event. --- Source/OpenTK/GameWindow.cs | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index b60e1ca5..29ee125f 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -325,7 +325,6 @@ namespace OpenTK try { glWindow.CreateWindow(mode); - } catch (ApplicationException expt) { @@ -573,6 +572,13 @@ namespace OpenTK //if (!isExiting) // InputDriver.Poll(); glWindow.ProcessEvents(); + + if (MustResize) + { + resizeEventArgs.Width = glWindow.Width; + resizeEventArgs.Height = glWindow.Height; + OnResizeInternal(resizeEventArgs); + } } #endregion @@ -622,16 +628,10 @@ namespace OpenTK { if (!this.Exists && !this.IsExiting) { - Debug.Print("WARNING: UpdateFrame event raised without a valid render window. This may indicate a programming error. Creating render window."); - mode = new DisplayMode(640, 480); - this.CreateWindow(mode); - } - - if (MustResize) - { - resizeEventArgs.Width = glWindow.Width; - resizeEventArgs.Height = glWindow.Height; - OnResizeInternal(resizeEventArgs); + //Debug.Print("WARNING: UpdateFrame event raised without a valid render window. This may indicate a programming error. Creating render window."); + //mode = new DisplayMode(640, 480); + //this.CreateWindow(mode); + throw new InvalidOperationException("Cannot enter game loop without a render window"); } if (UpdateFrame != null) @@ -673,6 +673,13 @@ namespace OpenTK /// private void OnLoadInternal(EventArgs e) { + if (MustResize) + { + resizeEventArgs.Width = glWindow.Width; + resizeEventArgs.Height = glWindow.Height; + OnResizeInternal(resizeEventArgs); + } + Debug.WriteLine(String.Format("OpenGL driver information: {0}, {1}, {2}", GL.GetString(GL.Enums.StringName.RENDERER), GL.GetString(GL.Enums.StringName.VENDOR),