Ejemplo n.º 1
0
        internal X11GLContext(int[] attributeList,
				X11GLContext share,
				IntPtr gdkDrawable)
        {
            // choose the visual based on attribute list
            xdisplay = gdk_x11_get_default_xdisplay();
            if (xdisplay == IntPtr.Zero)
                throw new SystemException("Couldn't get default display.");

            IntPtr visualInfo = glXChooseVisual (xdisplay,
                gdk_x11_get_default_screen(),
                attributeList);

            if (visualInfo == IntPtr.Zero)
                throw new SystemException ("No suitable glx-visual found.");

            // create glxcontext using visual
            try {
                IntPtr glxshare = IntPtr.Zero;
                if (share != null)
                    glxshare = share.glxcontext;

                bool directRendering = true;
                //bool directRendering = false;

                glxcontext = glXCreateContext (xdisplay,
                    visualInfo,
                    glxshare,
                    directRendering);
                if (glxcontext == IntPtr.Zero)
                    throw new SystemException ("Failed to create glx-context.");
            } finally {
                XFree (visualInfo);
            }
        }
Ejemplo n.º 2
0
        internal X11GLContext(int[] attributeList,
                              X11GLContext share,
                              IntPtr gdkDrawable)
        {
            // choose the visual based on attribute list
            xdisplay = gdk_x11_get_default_xdisplay();
            if (xdisplay == IntPtr.Zero)
            {
                throw new SystemException("Couldn't get default display.");
            }

            IntPtr visualInfo = glXChooseVisual(xdisplay,
                                                gdk_x11_get_default_screen(),
                                                attributeList);

            if (visualInfo == IntPtr.Zero)
            {
                throw new SystemException("No suitable glx-visual found.");
            }

            // create glxcontext using visual
            try {
                IntPtr glxshare = IntPtr.Zero;
                if (share != null)
                {
                    glxshare = share.glxcontext;
                }

                bool directRendering = true;
                //bool directRendering = false;

                glxcontext = glXCreateContext(xdisplay,
                                              visualInfo,
                                              glxshare,
                                              directRendering);
                if (glxcontext == IntPtr.Zero)
                {
                    throw new SystemException("Failed to create glx-context.");
                }
            } finally {
                XFree(visualInfo);
            }
        }