From c16968c06c1261f10db2ffdaff3bee048b199c10 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sat, 4 Aug 2007 12:17:30 +0000 Subject: [PATCH] Updated T10_GLSL_Cube to explicitly create a render window. Added input driver to W01_First_Window. Works perfectly! Added a debug message to GameWindow.cs, when accessing the opengl Context before creating a render window (this forces render window creation). --- Source/Examples/Tutorial/T10_GLSL_Cube.cs | 1 + Source/Examples/WinForms/W01_First_Window.cs | 8 ++++++++ Source/OpenTK/GameWindow.cs | 1 + 3 files changed, 10 insertions(+) diff --git a/Source/Examples/Tutorial/T10_GLSL_Cube.cs b/Source/Examples/Tutorial/T10_GLSL_Cube.cs index a104c602..34f7593e 100644 --- a/Source/Examples/Tutorial/T10_GLSL_Cube.cs +++ b/Source/Examples/Tutorial/T10_GLSL_Cube.cs @@ -50,6 +50,7 @@ namespace Examples.Tutorial public T10_GLSL_Cube() { + this.CreateWindow(new OpenTK.Platform.DisplayMode(800, 600)); Context.MakeCurrent(); //Text = diff --git a/Source/Examples/WinForms/W01_First_Window.cs b/Source/Examples/WinForms/W01_First_Window.cs index a50cee13..1bbafb77 100644 --- a/Source/Examples/WinForms/W01_First_Window.cs +++ b/Source/Examples/WinForms/W01_First_Window.cs @@ -23,6 +23,7 @@ namespace Examples.WinForms { public partial class W01_First_Window : Form, IExample { + OpenTK.InputDevices input; public W01_First_Window() { InitializeComponent(); @@ -30,6 +31,13 @@ namespace Examples.WinForms this.ShowDialog(); } + protected override void OnHandleCreated(EventArgs e) + { + base.OnHandleCreated(e); + + input = new OpenTK.InputDevices(this.Handle); + } + private void redButton_Click(object sender, EventArgs e) { GL.ClearColor(0.7f, 0.0f, 0.0f, 0.0f); diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index 5f2676d1..582a1f19 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -175,6 +175,7 @@ namespace OpenTK { if (!glWindow.Created) { + Debug.WriteLine("WARNING: OpenGL Context accessed before creating a render window. This may indicate a programming error. Force-creating a render window."); mode = new DisplayMode(640, 480); this.CreateWindow(mode); }