示例#1
0
    public static Cairo.Surface SetUp(Gdk.Drawable gdk_drawable)
    {
        IntPtr x_drawable = gdk_drawable.Handle;
        IntPtr dpy        = gdk_x11_drawable_get_xdisplay(x_drawable);
        int    scr        = 0;

        IntPtr visual    = gdk_drawable_get_visual(x_drawable);
        IntPtr Xvisual   = gdk_x11_visual_get_xvisual(visual);
        uint   XvisualID = XVisualIDFromVisual(Xvisual);

        Console.WriteLine("XvisID: " + XvisualID);


        IntPtr fmt = GlitzAPI.glitz_glx_find_drawable_format_for_visual(dpy, scr, XvisualID);

        Console.WriteLine("fmt: " + fmt);

        //IntPtr Xdrawable = gdk_x11_drawable_get_xid (x_drawable);
        uint win = gdk_x11_drawable_get_xid(x_drawable);
        uint w = 100, h = 100;

        IntPtr glitz_drawable = GlitzAPI.glitz_glx_create_drawable_for_window(dpy, scr, fmt, win, w, h);

        //NDesk.Glitz.Drawable ggd = new NDesk.Glitz.Drawable (glitz_drawable);
        ggd = new NDesk.Glitz.Drawable(glitz_drawable);

        IntPtr glitz_format   = ggd.FindStandardFormat(FormatName.ARGB32);

        ggs = new NDesk.Glitz.Surface(ggd, glitz_format, 100, 100, 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);

        //GlitzSurface gs = null;

        return(gs);
    }
示例#2
0
		public Buffer (Drawable drawable, IntPtr data)
		{
			Handle = GlitzAPI.glitz_buffer_create_for_data (data);
			GlitzAPI.glitz_buffer_reference (Handle);
		}
示例#3
0
		public Buffer (Drawable drawable, IntPtr data, uint size, BufferHint hint)
		{
			Handle = GlitzAPI.glitz_buffer_create (drawable.Handle, data, size, hint);
			GlitzAPI.glitz_buffer_reference (Handle);
		}
		public void MakeCurrent (Drawable drawable)
		{
			GlitzAPI.glitz_context_make_current (Handle, drawable.Handle);
		}
示例#5
0
    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);
    }
		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 Context (Drawable drawable, IntPtr format)
		{
			Handle = GlitzAPI.glitz_context_create (drawable.Handle, format);
			GlitzAPI.glitz_context_reference (Handle);
		}
		public void Attach (Drawable drawable, DrawableBuffer buffer)
		{
			GlitzAPI.glitz_surface_attach (Handle, drawable.Handle, buffer);
		}
		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);
		}
示例#10
0
		public Surface (Drawable drawable, IntPtr format, uint width, uint height, ulong mask, IntPtr attributes)
		{
			Handle = GlitzAPI.glitz_surface_create (drawable.Handle, format, width, height, mask, attributes);
			GlitzAPI.glitz_surface_reference (Handle);
		}
示例#11
0
 public void MakeCurrent(Drawable drawable)
 {
     GlitzAPI.glitz_context_make_current(Handle, drawable.Handle);
 }
示例#12
0
 public Context(Drawable drawable, IntPtr format)
 {
     Handle = GlitzAPI.glitz_context_create(drawable.Handle, format);
     GlitzAPI.glitz_context_reference(Handle);
 }
示例#13
0
	public static Cairo.Surface SetUp (Gdk.Drawable gdk_drawable)
	{
		IntPtr x_drawable = gdk_drawable.Handle;
		IntPtr dpy = gdk_x11_drawable_get_xdisplay(x_drawable);
		int scr = 0;

		IntPtr visual = gdk_drawable_get_visual(x_drawable);
		IntPtr Xvisual = gdk_x11_visual_get_xvisual(visual);
		uint XvisualID = XVisualIDFromVisual (Xvisual);

		Console.WriteLine ("XvisID: " + XvisualID);


		IntPtr fmt = GlitzAPI.glitz_glx_find_drawable_format_for_visual (dpy, scr, XvisualID);

		Console.WriteLine ("fmt: " + fmt);

		//IntPtr Xdrawable = gdk_x11_drawable_get_xid (x_drawable);
		uint win = gdk_x11_drawable_get_xid (x_drawable);
		uint w = 100, h = 100;

		IntPtr glitz_drawable = GlitzAPI.glitz_glx_create_drawable_for_window (dpy, scr, fmt, win, w, h);
		//NDesk.Glitz.Drawable ggd = new NDesk.Glitz.Drawable (glitz_drawable);
		ggd = new NDesk.Glitz.Drawable (glitz_drawable);

		IntPtr glitz_format = ggd.FindStandardFormat (FormatName.ARGB32);

		ggs = new NDesk.Glitz.Surface (ggd, glitz_format, 100, 100, 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);
		//GlitzSurface gs = null;

		return gs;
	}
示例#14
0
	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;
	}