//static extern IntPtr glitz_glx_find_window_format (IntPtr display, int screen, FormatMask mask, IntPtr glitz_drawable_format, int count); static extern IntPtr glitz_glx_find_window_format (IntPtr display, int screen, FormatMask mask, ref DrawableFormat templ, int count);
static extern IntPtr glitz_create_pbuffer_drawable (IntPtr other_drawable, ref DrawableFormat format, uint width, uint height);
public Drawable(Drawable other, ref DrawableFormat format, uint width, uint height) { this.Handle = GlitzAPI.glitz_create_drawable(other.Handle, ref format, width, height); GlitzAPI.glitz_drawable_reference(Handle); }
public static Drawable CreatePbuffer(Drawable other, ref DrawableFormat format, uint width, uint height) { IntPtr Handle = GlitzAPI.glitz_create_pbuffer_drawable(other.Handle, ref format, width, height); return(new Drawable(Handle)); }
static extern IntPtr glitz_create_pbuffer_drawable(IntPtr other_drawable, ref DrawableFormat format, uint width, uint height);
//static extern IntPtr glitz_glx_find_window_format (IntPtr display, int screen, FormatMask mask, IntPtr glitz_drawable_format, int count); static extern IntPtr glitz_glx_find_window_format(IntPtr display, int screen, FormatMask mask, ref DrawableFormat templ, int count);
public static Drawable CreatePbuffer (Drawable other, ref DrawableFormat format, uint width, uint height) { IntPtr Handle = GlitzAPI.glitz_create_pbuffer_drawable (other.Handle, ref format, width, height); return new Drawable (Handle); }
public Drawable (Drawable other, ref DrawableFormat format, uint width, uint height) { this.Handle = GlitzAPI.glitz_create_drawable (other.Handle, ref format, width, height); GlitzAPI.glitz_drawable_reference (Handle); }
public static Cairo.Surface Realize (Widget widget) { IntPtr dpy = gdk_x11_get_default_xdisplay (); int scr = gdk_x11_get_default_screen (); DrawableFormat template = new DrawableFormat (); template.Color = new ColorFormat (); FormatMask mask = FormatMask.None; //template.Doublebuffer = doublebuffer; //mask |= FormatMask.Doublebuffer; IntPtr dformat = GlitzAPI.glitz_glx_find_window_format (dpy, scr, mask, ref template, 0); if (dformat == IntPtr.Zero) throw new Exception ("Could not find a usable GL visual"); IntPtr vinfo = GlitzAPI.glitz_glx_get_visual_info_from_format (dpy, scr, dformat); widget.DoubleBuffered = false; Gdk.WindowAttr attributes = new Gdk.WindowAttr (); attributes.Mask = widget.Events | (Gdk.EventMask.ExposureMask | Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.StructureMask); //attributes.X = widget.Allocation.X; //attributes.Y = widget.Allocation.Y; attributes.X = 0; attributes.Y = 0; attributes.Width = 100; attributes.Height = 100; attributes.Wclass = Gdk.WindowClass.InputOutput; attributes.Visual = new Gdk.Visual (gdkx_visual_get (XVisualIDFromVisual (vinfo))); attributes.Colormap = new Gdk.Colormap (attributes.Visual, true); attributes.WindowType = Gdk.WindowType.Child; Gdk.WindowAttributesType attributes_mask = Gdk.WindowAttributesType.X | Gdk.WindowAttributesType.Y | Gdk.WindowAttributesType.Visual | Gdk.WindowAttributesType.Colormap; widget.GdkWindow = new Gdk.Window (widget.ParentWindow, attributes, attributes_mask); widget.GdkWindow.UserData = widget.Handle; uint xid = gdk_x11_drawable_get_xid (widget.GdkWindow.Handle); attributes.Width = 100; attributes.Height = 100; IntPtr glitz_drawable = GlitzAPI.glitz_glx_create_drawable_for_window (dpy, scr, dformat, xid, (uint)attributes.Width, (uint)attributes.Height); ggd = new NDesk.Glitz.Drawable (glitz_drawable); IntPtr glitz_format = ggd.FindStandardFormat (FormatName.ARGB32); ggs = new NDesk.Glitz.Surface (ggd, glitz_format, (uint)attributes.Width, (uint)attributes.Height, 0, IntPtr.Zero); Console.WriteLine (ggd.Features); ggs.Attach (ggd, doublebuffer ? DrawableBuffer.BackColor : DrawableBuffer.FrontColor); //GlitzAPI.glitz_drawable_destroy (glitz_drawable); GlitzSurface gs = new GlitzSurface (ggs.Handle); return gs; }