Ejemplo n.º 1
0
        public static GlContext TryCreate(DeviceContext deviceContext, int versionMajor, int versionMinor,
                                          retro_hw_context_type contextType, bool debug)
        {
            bool coreContext;

            if (contextType == retro_hw_context_type.RETRO_HW_CONTEXT_OPENGL_CORE)
            {
                coreContext = true;
            }
            else if (contextType == retro_hw_context_type.RETRO_HW_CONTEXT_OPENGL)
            {
                coreContext = false;
            }
            else // Unsupported context type
            {
                return(null);
            }

            GlContext context = new GlContext(deviceContext, versionMajor, versionMinor, coreContext, debug);

            if (context.Create(IntPtr.Zero))
            {
                return(context);
            }

            context.Dispose();
            return(null);
        }
Ejemplo n.º 2
0
        public GlContext CreateSharedContext()
        {
            GlContext sharedContext = new GlContext(_deviceContext, _versionMajor, _versionMinor, _coreContext, _debug);

            if (!sharedContext.Create(_glContext))
            {
                return(null);
            }
            return(sharedContext);
        }