diff --git a/Source/OpenTK/GLControl.cs b/Source/OpenTK/GLControl.cs index 0377a592..1feae21c 100644 --- a/Source/OpenTK/GLControl.cs +++ b/Source/OpenTK/GLControl.cs @@ -201,7 +201,7 @@ namespace OpenTK // Mono's implementation of Windows.Forms on X11 does not allow the context to // have a different colordepth from the parent. To combat this, we do not set a // specific depth for the DisplayMode - we let the driver select one instead. - display_mode.Color = new ColorMode(0); + //display_mode.ColorFormat = new ColorMode(0); context = new GLContext(display_mode, info); idle = new PlatformIdle(info); } diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index 6470cac1..11336f2f 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -328,7 +328,7 @@ namespace OpenTK { try { - glWindow.CreateWindow(mode, out glContext); + glWindow.CreateWindow(mode.Width, mode.Height, mode, out glContext); } catch (ApplicationException expt) { @@ -382,7 +382,7 @@ namespace OpenTK { // TODO: This is a hack - reslove in 0.3.15 once and for all! // GLContext is created inside the CreateWindow call. - glWindow.CreateWindow(mode, out glContext); + glWindow.CreateWindow(mode.Width, mode.Height, mode, out glContext); this.Title = title; } else @@ -1153,7 +1153,11 @@ namespace OpenTK /// /// Occurs when the GameWindow is resized. Derived classes should override the OnResize method for better performance. /// - public event ResizeEvent Resize; + public event ResizeEvent Resize + { + add { glWindow.Resize += value; } + remove { glWindow.Resize -= value; } + } /// /// Raises the Resize event. @@ -1165,9 +1169,9 @@ namespace OpenTK this.width = e.Width; this.height = e.Height; - - if (this.Resize != null) - this.Resize(this, e); + + //if (this.Resize != null) + // this.Resize(this, e); OnResize(e); } @@ -1215,7 +1219,7 @@ namespace OpenTK } */ #endregion -#if false // TODO: 0.3.15 (Linux support missing) +#if false // TODO: 0.9.2 (Linux support missing) #region PointToClient /// diff --git a/Source/OpenTK/Platform/INativeGLWindow.cs b/Source/OpenTK/Platform/INativeGLWindow.cs index e9d541a4..398d6279 100644 --- a/Source/OpenTK/Platform/INativeGLWindow.cs +++ b/Source/OpenTK/Platform/INativeGLWindow.cs @@ -17,7 +17,7 @@ namespace OpenTK.Platform /// interface INativeGLWindow : IResizable, IDisposable { - void CreateWindow(DisplayMode mode, out IGLContext context); + void CreateWindow(int width, int height, DisplayMode mode, out IGLContext context); void DestroyWindow(); void ProcessEvents(); void PointToClient(ref System.Drawing.Point p); diff --git a/Source/OpenTK/Platform/Windows/WinGLContext.cs b/Source/OpenTK/Platform/Windows/WinGLContext.cs index 2c627fdc..26909539 100644 --- a/Source/OpenTK/Platform/Windows/WinGLContext.cs +++ b/Source/OpenTK/Platform/Windows/WinGLContext.cs @@ -334,10 +334,10 @@ namespace OpenTK.Platform.Windows pixelFormat.AccumAlphaBits = (byte)accum.Alpha; } */ - pixelFormat.DepthBits = (byte)mode.DepthBits; - pixelFormat.StencilBits = (byte)mode.StencilBits; + pixelFormat.DepthBits = (byte)mode.Depth; + pixelFormat.StencilBits = (byte)mode.Stencil; - if (mode.DepthBits <= 0) + if (mode.Depth <= 0) { pixelFormat.Flags |= PixelFormatDescriptorFlags.DEPTH_DONTCARE; } diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs index 10d8e5b8..e6e170a2 100644 --- a/Source/OpenTK/Platform/Windows/WinGLNative.cs +++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs @@ -275,7 +275,7 @@ namespace OpenTK.Platform.Windows #region public void CreateWindow(DisplayMode mode, out IGLContext context) - public void CreateWindow(DisplayMode windowMode, out IGLContext context) + public void CreateWindow(int width, int height, DisplayMode windowMode, out IGLContext context) { Debug.Print("Creating native window with mode: {0}", windowMode.ToString()); Debug.Indent(); @@ -294,21 +294,21 @@ namespace OpenTK.Platform.Windows Rectangle rect = new Rectangle(); rect.top = rect.left = 0; - rect.bottom = windowMode.Height; - rect.right = windowMode.Width; + rect.bottom = height; + rect.right = width; Functions.AdjustWindowRect(ref rect, WindowStyle.OverlappedWindow, false); // Not used Top = 0; Left = 0; - Right = windowMode.Width; - Bottom = windowMode.Height; + Right = width; + Bottom = height; // -------- top_border = -rect.top; left_border = -rect.left; - bottom_border = rect.bottom - windowMode.Height; - right_border = rect.right - windowMode.Width; + bottom_border = rect.bottom - height; + right_border = rect.right - width; cp.Width = rect.right - rect.left; cp.Height = rect.bottom - rect.top; @@ -472,8 +472,8 @@ namespace OpenTK.Platform.Windows public void OnResize(ResizeEventArgs e) { - mode.Width = e.Width; - mode.Height = e.Height; + this.width = e.Width; + this.height = e.Height; if (this.Resize != null) this.Resize(this, e); } diff --git a/Source/OpenTK/Platform/X11/X11GLContext.cs b/Source/OpenTK/Platform/X11/X11GLContext.cs index f5f4cd31..3a5282c8 100644 --- a/Source/OpenTK/Platform/X11/X11GLContext.cs +++ b/Source/OpenTK/Platform/X11/X11GLContext.cs @@ -85,7 +85,7 @@ namespace OpenTK.Platform.X11 visualAttributes.Add((int)Glx.Enums.GLXAttribute.ALPHA_SIZE); visualAttributes.Add((int)mode.Color.Alpha); visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE); - visualAttributes.Add((int)mode.DepthBits); + visualAttributes.Add((int)mode.Depth); visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER); visualAttributes.Add((int)0); } diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs index c18a7afd..2217c3f4 100644 --- a/Source/OpenTK/Platform/X11/X11GLNative.cs +++ b/Source/OpenTK/Platform/X11/X11GLNative.cs @@ -347,7 +347,7 @@ namespace OpenTK.Platform.X11 /// Colormap creation is currently disabled. /// /// - public void CreateWindow(DisplayMode mode, out IGLContext glContext) + public void CreateWindow(int width, int height, DisplayMode mode, out IGLContext glContext) { if (exists) throw new ApplicationException("Render window already exists!");