public static IntPtr[] ChooseFBConfig(IntPtr dpy, int screen, int[] attribList) { int nitems; var fbcArrayPtr = glXChooseFBConfig(dpy, screen, attribList, out nitems); var fbcArray = new IntPtr[nitems]; Marshal.Copy(fbcArrayPtr, fbcArray, 0, nitems); Xlib.XFree(fbcArrayPtr); return(fbcArray); }
public static XVisualInfo GetVisualFromFBConfig(IntPtr dpy, IntPtr config) { var visualPtr = glXGetVisualFromFBConfig(dpy, config); if (visualPtr == IntPtr.Zero) { throw new Exception("Failed to retrieve visual from framebuffer config."); } var visual = (XVisualInfo)Marshal.PtrToStructure(visualPtr, typeof(XVisualInfo)); Xlib.XFree(visualPtr); return(visual); }