diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs
index 62e74f8d..dbae8dae 100644
--- a/src/OpenTK.GLWidget/GLWidget.cs
+++ b/src/OpenTK.GLWidget/GLWidget.cs
@@ -388,7 +388,7 @@ namespace OpenTK
}
else
{
- _WindowInfo = XWindowInfoInitializer.Initialize(graphicsMode, this.Display.Handle, this.Screen.Number, widgetWindowHandle, this.Screen.RootWindow.Handle);
+ _WindowInfo = XWindowInfoInitializer.Initialize(this.Display.Handle, this.Screen.Number, widgetWindowHandle, this.Screen.RootWindow.Handle);
}
// Make the GDK GL context current
diff --git a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs
index 74b86d54..2c047893 100644
--- a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs
+++ b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs
@@ -19,19 +19,15 @@ namespace OpenTK.X11
#else
const string UnixLibGdkName = "libgdk-x11-2.0.so.0";
#endif
- private const string UnixLibX11Name = "libX11.so.6";
- private const string UnixLibGLName = "libGL.so.1";
-
///
/// Initializes an under the X11 platform.
///
- ///
///
///
///
///
///
- public static IWindowInfo Initialize(GraphicsMode mode, IntPtr displayHandle, int screenNumber, IntPtr gdkWindowHandle, IntPtr gdkRootWindowHandle)
+ public static IWindowInfo Initialize(IntPtr displayHandle, int screenNumber, IntPtr gdkWindowHandle, IntPtr gdkRootWindowHandle)
{
IntPtr display = gdk_x11_display_get_xdisplay(displayHandle);
@@ -43,110 +39,11 @@ namespace OpenTK.X11
IntPtr rootWindowXid = gdk_x11_drawable_get_xid(gdkRootWindowHandle);
#endif
- IntPtr visualInfo;
- if (mode.Index.HasValue)
- {
- XVisualInfo info = new XVisualInfo
- {
- VisualID = mode.Index.Value
- };
-
- int dummy;
- visualInfo = XGetVisualInfo(display, XVisualInfoMask.ID, ref info, out dummy);
- }
- else
- {
- visualInfo = GetVisualInfo(mode, display, screenNumber);
- }
-
- IWindowInfo retval = Utilities.CreateX11WindowInfo(display, screenNumber, windowXid, rootWindowXid, visualInfo);
- XFree(visualInfo);
+ IWindowInfo retval = Utilities.CreateX11WindowInfo(display, screenNumber, windowXid, rootWindowXid, IntPtr.Zero);
return retval;
}
- private static IntPtr XGetVisualInfo(IntPtr display, XVisualInfoMask infoMask, ref XVisualInfo template, out int nitems)
- {
- return XGetVisualInfoInternal(display, (IntPtr)(int)infoMask, ref template, out nitems);
- }
-
- private static IntPtr GetVisualInfo(GraphicsMode mode, IntPtr display, int screenNumber)
- {
- try
- {
- int[] attributes = CreateAttributeList(mode).ToArray();
- return glXChooseVisual(display, screenNumber, attributes);
- }
- catch (DllNotFoundException e)
- {
- throw new DllNotFoundException("OpenGL dll not found!", e);
- }
- catch (EntryPointNotFoundException enf)
- {
- throw new EntryPointNotFoundException("Glx entry point not found!", enf);
- }
- }
-
- private static List CreateAttributeList(GraphicsMode mode)
- {
- List attributeList = new List(24);
-
- attributeList.Add((int)GLXAttribute.RGBA);
-
- if (mode.Buffers > 1)
- {
- attributeList.Add((int)GLXAttribute.DOUBLEBUFFER);
- }
-
- if (mode.Stereo)
- {
- attributeList.Add((int)GLXAttribute.STEREO);
- }
-
- attributeList.Add((int)GLXAttribute.RED_SIZE);
- attributeList.Add(mode.ColorFormat.Red / 4); // TODO support 16-bit
-
- attributeList.Add((int)GLXAttribute.GREEN_SIZE);
- attributeList.Add(mode.ColorFormat.Green / 4); // TODO support 16-bit
-
- attributeList.Add((int)GLXAttribute.BLUE_SIZE);
- attributeList.Add(mode.ColorFormat.Blue / 4); // TODO support 16-bit
-
- attributeList.Add((int)GLXAttribute.ALPHA_SIZE);
- attributeList.Add(mode.ColorFormat.Alpha / 4); // TODO support 16-bit
-
- attributeList.Add((int)GLXAttribute.DEPTH_SIZE);
- attributeList.Add(mode.Depth);
-
- attributeList.Add((int)GLXAttribute.STENCIL_SIZE);
- attributeList.Add(mode.Stencil);
-
- //attributeList.Add(GLX_AUX_BUFFERS);
- //attributeList.Add(Buffers);
-
- attributeList.Add((int)GLXAttribute.ACCUM_RED_SIZE);
- attributeList.Add(mode.AccumulatorFormat.Red / 4); // TODO support 16-bit
-
- attributeList.Add((int)GLXAttribute.ACCUM_GREEN_SIZE);
- attributeList.Add(mode.AccumulatorFormat.Green / 4); // TODO support 16-bit
-
- attributeList.Add((int)GLXAttribute.ACCUM_BLUE_SIZE);
- attributeList.Add(mode.AccumulatorFormat.Blue / 4); // TODO support 16-bit
-
- attributeList.Add((int)GLXAttribute.ACCUM_ALPHA_SIZE);
- attributeList.Add(mode.AccumulatorFormat.Alpha / 4); // TODO support 16-bit
-
- attributeList.Add((int)GLXAttribute.NONE);
-
- return attributeList;
- }
-
- [DllImport(UnixLibX11Name, EntryPoint = "XGetVisualInfo")]
- private static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr infoMask, ref XVisualInfo template, out int nitems);
-
- [SuppressUnmanagedCodeSecurity, DllImport(UnixLibX11Name)]
- private static extern void XFree(IntPtr handle);
-
#if GTK3
/// Returns the X resource (window or pixmap) belonging to a GdkWindow.
/// XID gdk_x11_window_get_xid(GdkWindow *drawable);
@@ -168,8 +65,5 @@ namespace OpenTK.X11
/// The X Display of the GdkDisplay.
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
private static extern IntPtr gdk_x11_display_get_xdisplay(IntPtr gdkDisplay);
-
- [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGLName)]
- private static extern IntPtr glXChooseVisual(IntPtr display, int screen, int[] attr);
}
}
\ No newline at end of file