diff --git a/Source/Examples/Tests/S01_Call_Performance.cs b/Source/Examples/Tests/S01_Call_Performance.cs index 90d384b1..fcc8e394 100644 --- a/Source/Examples/Tests/S01_Call_Performance.cs +++ b/Source/Examples/Tests/S01_Call_Performance.cs @@ -29,7 +29,7 @@ namespace Examples.Tests { using (Form f = new Form()) { - context = new GraphicsContext(new OpenTK.DisplayMode(), new OpenTK.Platform.WindowInfo(f)); + //context = new GraphicsContext(new OpenTK.DisplayMode(), new OpenTK.Platform.WindowInfo(f)); context.CreateContext(); Trace.WriteLine(String.Format("Number of calls: {0}", num_calls)); diff --git a/Source/Examples/Tests/S04_Input_Logger.cs b/Source/Examples/Tests/S04_Input_Logger.cs index 25978c8f..03845b79 100644 --- a/Source/Examples/Tests/S04_Input_Logger.cs +++ b/Source/Examples/Tests/S04_Input_Logger.cs @@ -35,7 +35,7 @@ namespace Examples.Tests void LaunchGameWindow() { - hidden = new GameWindow(new DisplayMode(30, 30), "OpenTK | Hidden input window"); + hidden = new GameWindow("OpenTK | Hidden input window", 16, 16); hidden.Load += hidden_Load; hidden.Unload += hidden_Unload; hidden.Run(60.0, 1.0); @@ -64,7 +64,7 @@ namespace Examples.Tests while (!start) Thread.Sleep(100); - WindowInfo info = new WindowInfo(this); + //WindowInfo info = new WindowInfo(this); keyboardListBoxes.Add(hidden.Keyboard.DeviceID, listBox1); @@ -84,7 +84,8 @@ namespace Examples.Tests { base.OnClosing(e); - hidden.Exit(); + hidden.ExitAsync(); + while (hidden.Exists) Thread.Sleep(100); diff --git a/Source/Examples/Tutorial/T10_GLSL_Cube.cs b/Source/Examples/Tutorial/T10_GLSL_Cube.cs index 0641b9ba..8e980746 100644 --- a/Source/Examples/Tutorial/T10_GLSL_Cube.cs +++ b/Source/Examples/Tutorial/T10_GLSL_Cube.cs @@ -64,7 +64,6 @@ namespace Examples.Tutorial MessageBox.Show("You need at least OpenGL 2.0 to run this example. Aborting.", "GLSL not supported", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.Exit(); - return; } GL.ClearColor(Color.SteelBlue); @@ -159,11 +158,16 @@ namespace Examples.Tutorial public override void OnUnload(EventArgs e) { - GL.DeleteProgram(shader_program); - GL.DeleteShader(fragment_shader_object); - GL.DeleteShader(vertex_shader_object); - GL.DeleteBuffers(1, ref vertex_buffer_object); - GL.DeleteBuffers(1, ref element_buffer_object); + if (shader_program != 0) + GL.DeleteProgram(shader_program); + if (fragment_shader_object != 0) + GL.DeleteShader(fragment_shader_object); + if (vertex_shader_object != 0) + GL.DeleteShader(vertex_shader_object); + if (vertex_buffer_object != 0) + GL.DeleteBuffers(1, ref vertex_buffer_object); + if (element_buffer_object != 0) + GL.DeleteBuffers(1, ref element_buffer_object); } #endregion diff --git a/Source/Examples/WinForms/W01_First_Window.cs b/Source/Examples/WinForms/W01_First_Window.cs index d2697875..fb11e277 100644 --- a/Source/Examples/WinForms/W01_First_Window.cs +++ b/Source/Examples/WinForms/W01_First_Window.cs @@ -27,16 +27,7 @@ namespace Examples.WinForms { public W01_First_Window() { - try - { - InitializeComponent(); - } - catch (Exception e) - { - System.Diagnostics.Trace.WriteLine("Exception during initialization, aborting: {0}", e.ToString()); - this.Close(); - return; - } + InitializeComponent(); } #region Events diff --git a/Source/Examples/WinForms/W03_Extensions.cs b/Source/Examples/WinForms/W03_Extensions.cs index b1b8d849..0cea8553 100644 --- a/Source/Examples/WinForms/W03_Extensions.cs +++ b/Source/Examples/WinForms/W03_Extensions.cs @@ -24,8 +24,7 @@ namespace Examples.WinForms [Example("Extensions", ExampleCategory.WinForms, 3)] public partial class W03_Extensions : Form { - //GLControl glControl = new GLControl(); - GraphicsContext context; + GLControl glControl = new GLControl(GraphicsFormat.Default); Type glClass; Type delegatesClass; Type importsClass; @@ -40,19 +39,19 @@ namespace Examples.WinForms delegatesClass = glClass.GetNestedType("Delegates", BindingFlags.Static | BindingFlags.NonPublic); importsClass = glClass.GetNestedType("Imports", BindingFlags.Static | BindingFlags.NonPublic); - //glControl.CreateControl(); + glControl.CreateControl(); Application.Idle += StartAsync; } + protected override void OnClosed(EventArgs e) + { + glControl.Dispose(); + } + void StartAsync(object sender, EventArgs e) { Application.Idle -= StartAsync; - context = new GraphicsContext(new DisplayMode(), new OpenTK.Platform.WindowInfo(this)); - context.CreateContext(); - - //while (!glControl.Created) - driver = GL.GetString(StringName.Vendor) + " " + GL.GetString(StringName.Renderer) + " " +