Beispiel #1
0
        public EglContext CreateContext(EglContext share, EglSurface offscreenSurface)
        {
            if (share != null && !SupportsSharing)
            {
                throw new NotSupportedException("Context sharing is not supported by this display");
            }

            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, share, ctx, _ => offscreenSurface, _version, _sampleCount, _stencilSize);

            rv.MakeCurrent(null);
            return(rv);
        }
Beispiel #2
0
 protected override bool ReleaseHandle()
 {
     using (_context.MakeCurrent())
         _egl.DestroySurface(_display.Handle, handle);
     return(true);
 }