Beispiel #1
0
        public EglContext CreateContext(IGlContext share)
        {
            if ((_surfaceType | EGL_PBUFFER_BIT) == 0)
            {
                throw new InvalidOperationException("Platform doesn't support PBUFFER surfaces");
            }
            var shareCtx = (EglContext)share;
            var ctx      = _egl.CreateContext(_display, _config, shareCtx?.Context ?? IntPtr.Zero, _contextAttributes);

            if (ctx == IntPtr.Zero)
            {
                throw OpenGlException.GetFormattedException("eglCreateContext", _egl);
            }
            var surf = _egl.CreatePBufferSurface(_display, _config, new[]
            {
                EGL_WIDTH, 1,
                EGL_HEIGHT, 1,
                EGL_NONE
            });

            if (surf == IntPtr.Zero)
            {
                throw OpenGlException.GetFormattedException("eglCreatePBufferSurface", _egl);
            }
            var rv = new EglContext(this, _egl, ctx, new EglSurface(this, _egl, surf));

            rv.MakeCurrent(null);
            return(rv);
        }
Beispiel #2
0
        public IGlContext CreateContext(IGlContext share)
        {
            var shareCtx = (EglContext)share;
            var ctx      = _egl.CreateContext(_display, _config, shareCtx?.Context ?? IntPtr.Zero, _contextAttributes);

            if (ctx == IntPtr.Zero)
            {
                throw OpenGlException.GetFormattedException("eglCreateContext", _egl);
            }
            var surf = _egl.CreatePBufferSurface(_display, _config, new[]
            {
                EGL_WIDTH, 1,
                EGL_HEIGHT, 1,
                EGL_NONE
            });

            if (surf == IntPtr.Zero)
            {
                throw OpenGlException.GetFormattedException("eglCreatePBufferSurface", _egl);
            }
            var rv = new EglContext(this, _egl, ctx, surf);

            rv.MakeCurrent(null);
            return(rv);
        }
Beispiel #3
0
        public EglContext CreateContext(EglContext share, EglSurface offscreenSurface)
        {
            var ctx = _egl.CreateContext(_display, _config, share?.Context ?? IntPtr.Zero, _contextAttributes);

            if (ctx == IntPtr.Zero)
            {
                throw OpenGlException.GetFormattedException("eglCreateContext", _egl);
            }
            var rv = new EglContext(this, _egl, ctx, offscreenSurface);

            rv.MakeCurrent(null);
            return(rv);
        }