public X11GLContext(GraphicsMode mode, X11Window window) { Debug.Print("Creating X11GLContext context: "); cur = window; XVisualInfo info = cur.VisualInfo; // Cannot pass a Property by reference. IntPtr display = API.DefaultDisplay; ContextHandle = Glx.glXCreateContext(display, ref info, IntPtr.Zero, true); if (ContextHandle == IntPtr.Zero) { Debug.Print("failed. Trying indirect... "); ContextHandle = Glx.glXCreateContext(display, ref info, IntPtr.Zero, false); } if (ContextHandle != IntPtr.Zero) { Debug.Print("Context created (id: {0}).", ContextHandle); } else { throw new GraphicsContextException("Context creation failed. Error: NULL returned"); } if (!Glx.glXIsDirect(display, ContextHandle)) { Debug.Print("Warning: Context is not direct."); } if (!Glx.glXMakeCurrent(API.DefaultDisplay, window.WinHandle, ContextHandle)) { throw new GraphicsContextException("Failed to make context current."); } Glx.LoadEntryPoints(); vsync_supported = Glx.glXSwapIntervalSGI != null; }