From 54258c91301410658d0011f1b2dd8af51cb73c47 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Thu, 9 Aug 2007 11:07:12 +0000 Subject: [PATCH] Fixed crash bug in X11GLNative. Almost ready for release. Niar! --- Source/OpenTK/Platform/X11/X11GLContext.cs | 12 +++++++----- Source/OpenTK/Platform/X11/X11GLNative.cs | 14 +++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Source/OpenTK/Platform/X11/X11GLContext.cs b/Source/OpenTK/Platform/X11/X11GLContext.cs index f0b3428f..49fc0778 100644 --- a/Source/OpenTK/Platform/X11/X11GLContext.cs +++ b/Source/OpenTK/Platform/X11/X11GLContext.cs @@ -187,7 +187,7 @@ namespace OpenTK.Platform.X11 { Debug.WriteLine("Creating visual."); Debug.Indent(); - +/* ColorDepth color = new ColorDepth(24); int depthBits = 16; @@ -205,8 +205,9 @@ namespace OpenTK.Platform.X11 visualAttributes.Add((int)Glx.Enums.GLXAttribute.DEPTH_SIZE); visualAttributes.Add((int)depthBits); visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER); - visualAttributes.Add((int)Glx.Enums.GLXAttribute.NONE); -/* + visualAttributes.Add((int)Glx.Enums.GLXAttribute.NONE); +*/ + Debug.Print("Requesting DisplayMode: {0}. ", mode.ToString()); // Hack; Temp workaround for invalid depth of 24 if (mode.DepthBits == 24) @@ -226,10 +227,11 @@ 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.DepthBits); + visualAttributes.Add(1); visualAttributes.Add((int)Glx.Enums.GLXAttribute.DOUBLEBUFFER); visualAttributes.Add((int)Glx.Enums.GLXAttribute.NONE); -*/ + visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, visualAttributes.ToArray()); if (visual == IntPtr.Zero) { diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs index acf04341..09a3a6eb 100644 --- a/Source/OpenTK/Platform/X11/X11GLNative.cs +++ b/Source/OpenTK/Platform/X11/X11GLNative.cs @@ -249,15 +249,19 @@ namespace OpenTK.Platform.X11 // Create a window on this display using the visual above Debug.Write("Creating output window... "); - XSetWindowAttributes attributes = new XSetWindowAttributes(); - //attributes.colormap = glContext.colormap; + XSetWindowAttributes attributes = new XSetWindowAttributes(); + attributes.background_pixel = IntPtr.Zero; + attributes.border_pixel = IntPtr.Zero; + attributes.colormap = API.CreateColormap(window.Display, window.RootWindow, + window.VisualInfo.visual, 0/*AllocNone*/); //glContext.colormap; attributes.event_mask = (IntPtr)(EventMask.StructureNotifyMask | EventMask.SubstructureNotifyMask | EventMask.ExposureMask); - uint mask = (uint)SetWindowValuemask.ColorMap | (uint)SetWindowValuemask.EventMask; + uint mask = (uint)SetWindowValuemask.ColorMap | (uint)SetWindowValuemask.EventMask | + (uint)SetWindowValuemask.BackPixel | (uint)SetWindowValuemask.BorderPixel; - window.Handle = Functions.XCreateWindow(window.Display, /*window.RootWindow*/IntPtr.Zero, - 0, 0, mode.Width, mode.Height, 0, /*window.VisualInfo.depth*/(int)CreateWindowArgs.CopyFromParent, + window.Handle = Functions.XCreateWindow(window.Display, window.RootWindow, + 0, 0, mode.Width, mode.Height, 0, window.VisualInfo.depth/*(int)CreateWindowArgs.CopyFromParent*/, (int)CreateWindowArgs.InputOutput, window.VisualInfo.visual, (UIntPtr)mask, ref attributes);