Fixed crash bug in X11GLNative. Almost ready for release. Niar!

This commit is contained in:
the_fiddler 2007-08-09 11:07:12 +00:00
parent 7287e5d5a4
commit cccbb9823b
2 changed files with 16 additions and 10 deletions

View file

@ -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)
{

View file

@ -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);