diff --git a/Source/Examples/WinForms/W01_First_Window.cs b/Source/Examples/WinForms/W01_First_Window.cs
index 58c3deb3..0b89e410 100644
--- a/Source/Examples/WinForms/W01_First_Window.cs
+++ b/Source/Examples/WinForms/W01_First_Window.cs
@@ -32,6 +32,7 @@ namespace Examples.WinForms
catch (Exception e)
{
System.Diagnostics.Trace.WriteLine("Exception during initialization, aborting: {0}", e.ToString());
+ this.Close();
return;
}
}
diff --git a/Source/OpenTK/GLContext.cs b/Source/OpenTK/GLContext.cs
new file mode 100644
index 00000000..c5e59145
--- /dev/null
+++ b/Source/OpenTK/GLContext.cs
@@ -0,0 +1,170 @@
+#region --- License ---
+/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
+ * See license.txt for license info
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using OpenTK.Platform;
+
+namespace OpenTK
+{
+ ///
+ /// Represents and provides methods to manipulate an OpenGL render context.
+ ///
+ public class GLContext : IGLContext
+ {
+ ///
+ /// The actual render context implementation for the underlying platform.
+ ///
+ private IGLContext implementation;
+
+ ///
+ /// Constructs a new GLContext with the specified DisplayMode, and bound to the specified IWindowInfo.
+ ///
+ ///
+ ///
+ public GLContext(DisplayMode mode, IWindowInfo window)
+ {
+ switch (Environment.OSVersion.Platform)
+ {
+ case PlatformID.Unix:
+ case (PlatformID)128:
+ implementation = new OpenTK.Platform.X11.X11GLContext(mode, window);
+ break;
+
+ case PlatformID.Win32NT:
+ case PlatformID.Win32S:
+ case PlatformID.Win32Windows:
+ case PlatformID.WinCE:
+ implementation = new OpenTK.Platform.Windows.WinGLContext(mode, window);
+ break;
+
+ default:
+ throw new PlatformNotSupportedException("Your platform is not supported currently. Please, refer to http://opentk.sourceforge.net for more information.");
+ }
+ }
+
+ #region --- IGLContext Members ---
+
+ ///
+ /// Gets a handle to the OpenGL rendering context.
+ ///
+ public IntPtr Context
+ {
+ get { return implementation.Context; }
+ }
+
+ ///
+ /// Gets the IWindowInfo describing the window associated with this context.
+ ///
+ public IWindowInfo Info
+ {
+ get { return implementation.Info; }
+ }
+
+ ///
+ /// Gets the DisplayMode of the context.
+ ///
+ public DisplayMode Mode
+ {
+ get { return implementation.Mode; }
+ }
+
+ ///
+ /// Creates an OpenGL context.
+ ///
+ public void CreateContext()
+ {
+ implementation.CreateContext();
+ }
+
+ ///
+ /// Creates an OpenGL context with a direct or indirect rendering mode. This parameter is ignored
+ /// on Windows platforms (direct mode only).
+ ///
+ /// Set to true for direct rendering or false otherwise.
+ ///
+ ///
+ /// Direct rendering is the default rendering mode for OpenTK, since it can provide higher performance
+ /// in some circumastances.
+ ///
+ ///
+ /// The 'direct' parameter is a hint, and will ignored if the specified mode is not supported (e.g. setting
+ /// indirect rendering on Windows platforms).
+ ///
+ ///
+ public void CreateContext(bool direct)
+ {
+ implementation.CreateContext(direct);
+ }
+
+ ///
+ /// Creates an OpenGL context with the specified direct/indirect rendering mode and sharing state with the
+ /// specified IGLContext.
+ ///
+ /// Set to true for direct rendering or false otherwise.
+ /// The source IGLContext to share state from..
+ ///
+ public void CreateContext(bool direct, IGLContext source)
+ {
+ implementation.CreateContext(direct, source);
+ }
+
+ ///
+ /// Swaps buffers on a context. This presents the rendered scene to the user.
+ ///
+ public void SwapBuffers()
+ {
+ implementation.SwapBuffers();
+ }
+
+ ///
+ /// Makes this context the current rendering target.
+ ///
+ public void MakeCurrent()
+ {
+ implementation.MakeCurrent();
+ }
+
+ ///
+ /// Gets the address of an OpenGL extension function.
+ ///
+ /// The name of the OpenGL function (e.g. "glGetString")
+ ///
+ /// A pointer to the specified function or IntPtr.Zero if the function isn't
+ /// available in the current opengl context.
+ ///
+ ///
+ public IntPtr GetAddress(string function)
+ {
+ return implementation.GetAddress(function);
+ }
+
+ ///
+ /// Returns the display modes supported by the current opengl context.
+ ///
+ /// An IEnumerable containing all supported display modes.
+ public IEnumerable GetDisplayModes()
+ {
+ return implementation.GetDisplayModes();
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ ///
+ /// Disposes of the GLContext.
+ ///
+ public void Dispose()
+ {
+ implementation.Dispose();
+ }
+
+ #endregion
+ }
+}
diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs
index b0d6b53e..b23fcfb7 100644
--- a/Source/OpenTK/GameWindow.cs
+++ b/Source/OpenTK/GameWindow.cs
@@ -38,20 +38,22 @@ namespace OpenTK
///
public GameWindow()
{
- if (Environment.OSVersion.Platform == PlatformID.Win32NT ||
- Environment.OSVersion.Platform == PlatformID.Win32Windows)
+ switch (Environment.OSVersion.Platform)
{
- glWindow = new OpenTK.Platform.Windows.WinGLNative();
- }
- else if (Environment.OSVersion.Platform == PlatformID.Unix)
- {
- glWindow = new OpenTK.Platform.X11.X11GLNative();
- }
- else
- {
- throw new PlatformNotSupportedException(
- "Your platform is not currently supported. Refer to http://opentk.sourceforge.net for more information."
- );
+ case PlatformID.Win32NT:
+ case PlatformID.Win32S:
+ case PlatformID.Win32Windows:
+ case PlatformID.WinCE:
+ glWindow = new OpenTK.Platform.Windows.WinGLNative();
+ break;
+
+ case PlatformID.Unix:
+ case (PlatformID)128:
+ glWindow = new OpenTK.Platform.X11.X11GLNative();
+ break;
+
+ default:
+ throw new PlatformNotSupportedException("Your platform is not supported currently. Please, refer to http://opentk.sourceforge.net for more information.");
}
glWindow.Resize += new ResizeEvent(glWindow_Resize);
diff --git a/Source/OpenTK/OpenGL/GluHelper.cs b/Source/OpenTK/OpenGL/GluHelper.cs
index 280abe9e..16f99bba 100644
--- a/Source/OpenTK/OpenGL/GluHelper.cs
+++ b/Source/OpenTK/OpenGL/GluHelper.cs
@@ -1,4 +1,10 @@
-using System;
+#region --- License ---
+/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
+ * See license.txt for license info
+ */
+#endregion
+
+using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
diff --git a/Source/OpenTK/Platform/DummyGLContext.cs b/Source/OpenTK/Platform/DummyGLContext.cs
index 0f95ac21..a3916087 100644
--- a/Source/OpenTK/Platform/DummyGLContext.cs
+++ b/Source/OpenTK/Platform/DummyGLContext.cs
@@ -1,4 +1,10 @@
-using System;
+#region --- License ---
+/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
+ * See license.txt for license info
+ */
+#endregion
+
+using System;
using System.Collections.Generic;
using System.Text;
diff --git a/Source/OpenTK/Platform/DummyGLControl.cs b/Source/OpenTK/Platform/DummyGLControl.cs
index eb16ef72..c0476de6 100644
--- a/Source/OpenTK/Platform/DummyGLControl.cs
+++ b/Source/OpenTK/Platform/DummyGLControl.cs
@@ -1,4 +1,10 @@
-using System;
+#region --- License ---
+/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
+ * See license.txt for license info
+ */
+#endregion
+
+using System;
using System.Collections.Generic;
using System.Text;
diff --git a/Source/OpenTK/Platform/GLContext.cs b/Source/OpenTK/Platform/GLContext.cs
deleted file mode 100644
index 0edf4aae..00000000
--- a/Source/OpenTK/Platform/GLContext.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace OpenTK.Platform
-{
- public class GLContext : IGLContext
- {
- private IGLContext implementation;
-
- public GLContext(DisplayMode mode, IWindowInfo window)
- {
-
- }
-
- #region --- IGLContext Members ---
-
- public IntPtr Context
- {
- get { return implementation.Context; }
- }
-
- public IWindowInfo Info
- {
- get { throw new Exception("The method or operation is not implemented."); }
- }
-
- public DisplayMode Mode
- {
- get { throw new Exception("The method or operation is not implemented."); }
- }
-
- public void CreateContext()
- {
- throw new Exception("The method or operation is not implemented.");
- }
-
- public void CreateContext(bool direct)
- {
- throw new Exception("The method or operation is not implemented.");
- }
-
- public void CreateContext(bool direct, IGLContext source)
- {
- throw new Exception("The method or operation is not implemented.");
- }
-
- public void SwapBuffers()
- {
- throw new Exception("The method or operation is not implemented.");
- }
-
- public void MakeCurrent()
- {
- throw new Exception("The method or operation is not implemented.");
- }
-
- public IntPtr GetAddress(string function)
- {
- throw new Exception("The method or operation is not implemented.");
- }
-
- public IEnumerable GetDisplayModes()
- {
- throw new Exception("The method or operation is not implemented.");
- }
-
- #endregion
-
- #region IDisposable Members
-
- public void Dispose()
- {
- throw new Exception("The method or operation is not implemented.");
- }
-
- #endregion
- }
-}
diff --git a/Source/OpenTK/Platform/IGLContext.cs b/Source/OpenTK/Platform/IGLContext.cs
index 086abd95..80abdbd9 100644
--- a/Source/OpenTK/Platform/IGLContext.cs
+++ b/Source/OpenTK/Platform/IGLContext.cs
@@ -85,7 +85,7 @@ namespace OpenTK.Platform
///
/// Returns the display modes supported by the current opengl context.
///
- /// An array containing all supported display modes.
+ /// An IEnumerable containing all supported display modes.
IEnumerable GetDisplayModes();
}
}
diff --git a/Source/OpenTK/Platform/IMutableWindowInfo.cs b/Source/OpenTK/Platform/IMutableWindowInfo.cs
index be38194b..8bf3b14a 100644
--- a/Source/OpenTK/Platform/IMutableWindowInfo.cs
+++ b/Source/OpenTK/Platform/IMutableWindowInfo.cs
@@ -1,4 +1,10 @@
-using System;
+#region --- License ---
+/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
+ * See license.txt for license info
+ */
+#endregion
+
+using System;
using System.Collections.Generic;
using System.Text;
diff --git a/Source/OpenTK/Platform/WindowInfo.cs b/Source/OpenTK/Platform/WindowInfo.cs
index 41d06222..dda6a25e 100644
--- a/Source/OpenTK/Platform/WindowInfo.cs
+++ b/Source/OpenTK/Platform/WindowInfo.cs
@@ -1,4 +1,10 @@
-using System;
+#region --- License ---
+/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
+ * See license.txt for license info
+ */
+#endregion
+
+using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;