diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index a373565e..368654fd 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -203,7 +203,15 @@ namespace OpenTK { if (!Exists) { - glWindow.CreateWindow(mode); + try + { + glWindow.CreateWindow(mode); + } + catch (ApplicationException expt) + { + Debug.Print(expt.ToString()); + throw; + } OpenTK.OpenGL.GL.LoadAll(); } else diff --git a/Source/OpenTK/Platform/X11/X11GLContext.cs b/Source/OpenTK/Platform/X11/X11GLContext.cs index 2cb6baf5..ea811cc2 100644 --- a/Source/OpenTK/Platform/X11/X11GLContext.cs +++ b/Source/OpenTK/Platform/X11/X11GLContext.cs @@ -98,8 +98,8 @@ visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, attrib); visualAttributes.Add((int)mode.Color.Green); visualAttributes.Add((int)Glx.Enums.GLXAttribute.BLUE_SIZE); visualAttributes.Add((int)mode.Color.Blue); - //visualAttributes.Add((int)Glx.Enums.GLXAttribute.ALPHA_SIZE); - //visualAttributes.Add((int)mode.Color.Alpha); + 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)1); @@ -161,7 +161,6 @@ visual = Glx.ChooseVisual(windowInfo.Display, windowInfo.Screen, attrib); public void SwapBuffers() { - Debug.Print("Swapping buffers"); Glx.SwapBuffers(windowInfo.Display, windowInfo.Handle); } diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs index b58e3bc4..c03256a5 100644 --- a/Source/OpenTK/Platform/X11/X11GLNative.cs +++ b/Source/OpenTK/Platform/X11/X11GLNative.cs @@ -76,7 +76,7 @@ namespace OpenTK.Platform.X11 Functions.XNextEvent(window.Display, ref e); - Debug.WriteLine(String.Format("Event: {0} ({1} pending)", e.type, pending)); + Debug.Print("Event: {0} ({1} pending)", e.type, pending); // Respond to the event e switch (e.type) @@ -118,6 +118,10 @@ namespace OpenTK.Platform.X11 } break; + case XEventName.KeyPress: + case XEventName.KeyRelease: + return; + default: Debug.WriteLine(String.Format("{0} event was not handled", e.type)); break; @@ -237,12 +241,8 @@ namespace OpenTK.Platform.X11 window.Screen = API.DefaultScreen(window.Display); window.RootWindow = API.RootWindow(window.Display, window.Screen); - Debug.Print( - "Display: {0}, Screen {1}, Root window: {2}", - window.Display, - window.Screen, - window.RootWindow - ); + Debug.Print("Display: {0}, Screen {1}, Root window: {2}", + window.Display, window.Screen, window.RootWindow); glContext = new X11GLContext(mode); glContext.PrepareContext(window); @@ -264,8 +264,7 @@ namespace OpenTK.Platform.X11 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); + (int)CreateWindowArgs.InputOutput, window.VisualInfo.visual, (UIntPtr)mask, ref attributes); if (window.Handle == IntPtr.Zero) { @@ -297,10 +296,7 @@ namespace OpenTK.Platform.X11 Debug.Print("done! (id: {0})", window.Handle); - API.MapRaised(window.Display, window.Handle); - - /*Debug.WriteLine("Mapped window."); - + /* XEvent ev = new XEvent(); API.IfEvent(window.Display, ref ev, delegate(IntPtr display, ref XEvent @event, IntPtr arg) @@ -314,16 +310,16 @@ namespace OpenTK.Platform.X11 }, window.Handle); */ - glContext.Mode = mode;//new DisplayMode(mode); glContext.windowInfo.Handle = window.Handle; glContext.CreateContext(null, true); API.MapRaised(window.Display, window.Handle); - Debug.WriteLine("Mapped window."); - Debug.WriteLine("Our shiny new context is now current - ready to rock 'n' roll!"); + glContext.MakeCurrent(); + Debug.Unindent(); + Debug.WriteLine("GameWindow creation completed successfully!"); exists = true; } }