public static IntPtr SelectFBConfig(IntPtr display, FramebufferFormat format) { List <int> visualAttribute = FramebufferFormatToVisualAttribute(format); IntPtr result = IntPtr.Zero; // TODO: make screen configurable? int screen = DefaultScreenLocked(display); int fbcount; unsafe { IntPtr *fbConfigs = GLX.ChooseFBConfig(display, screen, visualAttribute.ToArray(), out fbcount); if (fbcount > 0 && fbConfigs != null) { result = *fbConfigs; XFree((IntPtr)fbConfigs); } } return(result); }
protected override void Dispose(bool disposing) { if (!IsDisposed) { if (disposing) { MakeCurrent(null); GLX.DestroyContext(_display, ContextHandle); } IsDisposed = true; } }
public override void MakeCurrent(NativeWindowBase window) { if (_window != null && window != null && _window.WindowHandle.RawHandle == window.WindowHandle.RawHandle && IsCurrent) { return; } bool success; if (window != null) { if (!(window is GLXWindow)) { throw new InvalidOperationException($"MakeCurrent() should be used with a {typeof(GLXWindow).Name}."); } if (_display != window.DisplayHandle.RawHandle) { throw new InvalidOperationException("MakeCurrent() should be used with a window originated from the same display."); } success = GLX.MakeCurrent(_display, window.WindowHandle.RawHandle, ContextHandle); } else { success = GLX.MakeCurrent(_display, IntPtr.Zero, IntPtr.Zero); } if (success) { _window = window; } else { throw new ContextException("MakeCurrent() failed."); } }
public override void SwapBuffers() { GLX.SwapBuffers(DisplayHandle.RawHandle, WindowHandle.RawHandle); }