示例#1
0
        internal iPhoneOSGraphicsContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext sharedContext, int major, int minor, GraphicsContextFlags flags)
        {
            // ignore mode, window
            iPhoneOSGraphicsContext shared = null;
            var internalSharedContext      = sharedContext as OpenTK.Graphics.IGraphicsContextInternal;

            if (internalSharedContext != null)
            {
                shared = internalSharedContext.Implementation as iPhoneOSGraphicsContext;
            }
            EAGLRenderingAPI version = 0;

            if (major == 1 && minor == 1)
            {
                version = EAGLRenderingAPI.OpenGLES1;
            }
            else if (major == 2 && minor == 0)
            {
                version = EAGLRenderingAPI.OpenGLES2;
            }
            else
            {
                throw new ArgumentException(string.Format("Unsupported GLES version {0}.{1}.", major, minor));
            }

            EAGLContext = shared != null && shared.EAGLContext != null
                ? new EAGLContext(version, shared.EAGLContext.ShareGroup)
                : new EAGLContext(version);
            contextHandle = new ContextHandle(EAGLContext.Handle);
        }
示例#2
0
        internal iPhoneOSGraphicsContext(ContextHandle handle, IWindowInfo window, IGraphicsContext sharedContext, int major, int minor, GraphicsContextFlags flags)
        {
            // ignore mode, window

            iPhoneOSGraphicsContext shared = sharedContext as iPhoneOSGraphicsContext;

            EAGLRenderingAPI version = 0;

            if (major == 1 && minor == 1)
            {
                version = EAGLRenderingAPI.OpenGLES1;
            }
            else if (major == 2 && minor == 0)
            {
                version = EAGLRenderingAPI.OpenGLES2;
            }
            else
            {
                throw new ArgumentException(string.Format("Unsupported GLES version {0}.{1}.", major, minor));
            }

            if (handle.Handle == IntPtr.Zero)
            {
                EAGLContext = shared != null && shared.EAGLContext != null
                    ? new EAGLContext(version, shared.EAGLContext.ShareGroup)
                    : new EAGLContext(version);
                contextHandle = new ContextHandle(EAGLContext.Handle);
            }
            else
            {
                EAGLContext   = (EAGLContext)Runtime.GetNSObject(handle.Handle);
                contextHandle = handle;
            }
        }