diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs
index f50ca8b4..061164be 100644
--- a/Source/OpenTK/GameWindow.cs
+++ b/Source/OpenTK/GameWindow.cs
@@ -149,6 +149,25 @@ namespace OpenTK
/// GameWindow options regarding window appearance and behavior.
/// The OpenTK.Graphics.DisplayDevice to construct the GameWindow in.
public GameWindow(int width, int height, GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device)
+ : this(width, height, mode, title, options, device, 1, 0, GraphicsContextFlags.Default)
+ { }
+
+ #endregion
+
+ #region public GameWindow(int width, int height, GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device, int major, int minor, GraphicsContextFlags flags)
+
+ /// Constructs a new GameWindow with the specified attributes.
+ /// The width of the GameWindow in pixels.
+ /// The height of the GameWindow in pixels.
+ /// The OpenTK.Graphics.GraphicsMode of the GameWindow.
+ /// The title of the GameWindow.
+ /// GameWindow options regarding window appearance and behavior.
+ /// The OpenTK.Graphics.DisplayDevice to construct the GameWindow in.
+ /// The major version for the OpenGL GraphicsContext.
+ /// The minor version for the OpenGL GraphicsContext.
+ /// The GraphicsContextFlags version for the OpenGL GraphicsContext.
+ public GameWindow(int width, int height, GraphicsMode mode, string title, GameWindowFlags options, DisplayDevice device,
+ int major, int minor, GraphicsContextFlags flags)
{
if (width <= 0) throw new ArgumentOutOfRangeException("width", "Must be greater than zero.");
if (height <= 0) throw new ArgumentOutOfRangeException("width", "Must be greater than zero.");
@@ -157,12 +176,12 @@ namespace OpenTK
if (device == null)
device = DisplayDevice.Default;
- glWindow = Platform.Factory.CreateNativeGLWindow();
+ glWindow = Platform.Factory.CreateNativeGLWindow();
glWindow.Destroy += glWindow_Destroy;
try
{
- glWindow.CreateWindow(width, height, mode, out glContext);
+ glWindow.CreateWindow(width, height, mode, major, minor, flags, out glContext);
glContext.MakeCurrent(this.WindowInfo);
(glContext as IGraphicsContextInternal).LoadAll();
}
@@ -173,30 +192,23 @@ namespace OpenTK
glWindow.DestroyWindow();
throw;
}
-
+
this.Title = title;
-
+
if ((options & GameWindowFlags.Fullscreen) != 0)
{
device.ChangeResolution(width, height, mode.ColorFormat.BitsPerPixel, 0);
this.WindowState = WindowState.Fullscreen;
//throw new NotImplementedException();
}
-
+
this.VSync = VSyncMode.On; //VSyncMode.Adaptive;
- glWindow.Resize += new ResizeEvent(glWindow_Resize);
-
+ glWindow.Resize += delegate(object sender, ResizeEventArgs e) { OnResizeInternal(e); };
}
- void glWindow_Resize(object sender, ResizeEventArgs e)
- {
- Debug.Print("glWindow_Resize event fired.");
-
- OnResizeInternal(e);
- }
-
-
#endregion
+
+ #region Obsolete
///
/// Constructs a new GameWindow, and opens a render window with the specified DisplayMode.
@@ -218,6 +230,8 @@ namespace OpenTK
#endregion
+ #endregion
+
#region --- Private Methods ---
#region void glWindow_Destroy(object sender, EventArgs e)
diff --git a/Source/OpenTK/Platform/INativeGLWindow.cs b/Source/OpenTK/Platform/INativeGLWindow.cs
index 3874223d..5cdc561e 100644
--- a/Source/OpenTK/Platform/INativeGLWindow.cs
+++ b/Source/OpenTK/Platform/INativeGLWindow.cs
@@ -15,12 +15,9 @@ using OpenTK.Graphics;
namespace OpenTK.Platform
{
- ///
- /// This interface supports OpenTK, and is not intended for use by OpenTK programs.
- ///
internal interface INativeGLWindow : IResizable, IDisposable
{
- void CreateWindow(int width, int height, GraphicsMode mode, out IGraphicsContext context);
+ void CreateWindow(int width, int height, GraphicsMode mode, int major, int minor, GraphicsContextFlags flags, out IGraphicsContext context);
void DestroyWindow();
void ProcessEvents();
void PointToClient(ref System.Drawing.Point p);
@@ -32,9 +29,7 @@ namespace OpenTK.Platform
string Title { get; set; }
bool Visible { get; set; }
bool IsIdle { get; }
- //IGraphicsContext Context { get; }
IInputDriver InputDriver { get; }
- //bool Fullscreen { get; set; }
WindowState WindowState { get; set; }
WindowBorder WindowBorder { get; set; }
diff --git a/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs b/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs
index 8231a062..860a0698 100644
--- a/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs
+++ b/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs
@@ -574,14 +574,14 @@ namespace OpenTK.Platform.MacOS
#region INativeGLWindow Members
- public void CreateWindow(int width, int height, OpenTK.Graphics.GraphicsMode mode, out OpenTK.Graphics.IGraphicsContext context)
+ public void CreateWindow(int width, int height, OpenTK.Graphics.GraphicsMode mode, int major, int minor, GraphicsContextFlags flags, out OpenTK.Graphics.IGraphicsContext context)
{
Rect r = new Rect(0, 0, (short)width, (short)height);
CreateNativeWindow(mWindowClass, mWindowAttrib, r);
Show();
- this.context = new Graphics.GraphicsContext(mode, window);
+ this.context = new Graphics.GraphicsContext(mode, window, major, minor, flags);
this.context.MakeCurrent(window);
context = this.context;
diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs
index f94bc87a..3312d08a 100644
--- a/Source/OpenTK/Platform/Windows/WinGLNative.cs
+++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs
@@ -311,7 +311,7 @@ namespace OpenTK.Platform.Windows
#region public void CreateWindow(int width, int height, GraphicsMode mode, out IGraphicsContext context)
- public void CreateWindow(int width, int height, GraphicsMode mode, out IGraphicsContext context)
+ public void CreateWindow(int width, int height, GraphicsMode mode, int major, int minor, GraphicsContextFlags flags, out IGraphicsContext context)
{
Debug.Print("Creating native window.");
Debug.Indent();
@@ -370,7 +370,7 @@ namespace OpenTK.Platform.Windows
Functions.SetWindowPos(this.Handle, IntPtr.Zero, Left, Top, rect.right - rect.left,
rect.bottom - rect.top, SetWindowPosFlags.SHOWWINDOW);
- context = new GraphicsContext(mode, window);
+ context = new GraphicsContext(mode, window, major, minor, flags);
Cursor.Current = Cursors.Default;
diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs
index d43801c7..23f562af 100644
--- a/Source/OpenTK/Platform/X11/X11GLNative.cs
+++ b/Source/OpenTK/Platform/X11/X11GLNative.cs
@@ -199,9 +199,9 @@ namespace OpenTK.Platform.X11
#region --- INativeGLWindow Members ---
- #region public void CreateWindow(int width, int height, GraphicsMode mode, out IGraphicsContext context)
+ #region CreateWindow
- public void CreateWindow(int width, int height, GraphicsMode mode, out IGraphicsContext context)
+ public void CreateWindow(int width, int height, GraphicsMode mode, int major, int minor, GraphicsContextFlags flags, out IGraphicsContext context)
{
if (width <= 0) throw new ArgumentOutOfRangeException("width", "Must be higher than zero.");
if (height <= 0) throw new ArgumentOutOfRangeException("height", "Must be higher than zero.");
@@ -244,7 +244,7 @@ namespace OpenTK.Platform.X11
//XVisualInfo vis = window.VisualInfo;
//Glx.CreateContext(window.Display, ref vis, IntPtr.Zero, true);
}
- context = new GraphicsContext(mode, window);
+ context = new GraphicsContext(mode, window, major, minor, flags);
// Set the window hints
SetWindowMinMax(_min_width, _min_height, -1, -1);