Example #1
0
 public EglContext(EglDisplay display, EglInterface egl, IntPtr ctx, EglSurface offscreenSurface)
 {
     _disp            = display;
     _egl             = egl;
     Context          = ctx;
     OffscreenSurface = offscreenSurface;
 }
Example #2
0
 public Session(IGlContext context, EglSurface glSurface, IEglWindowGlPlatformSurfaceInfo info,
                IDisposable @lock)
 {
     _context   = context;
     _glSurface = glSurface;
     _info      = info;
     _lock      = @lock;
 }
Example #3
0
        public void MakeCurrent(EglSurface surface)
        {
            var surf = surface?.DangerousGetHandle() ?? OffscreenSurface;

            if (!_egl.MakeCurrent(_disp.Handle, surf, surf, Context))
            {
                throw OpenGlException.GetFormattedException("eglMakeCurrent", _egl);
            }
        }
Example #4
0
        public void MakeCurrent(EglSurface surface)
        {
            var surf = ((EglSurface)surface)?.DangerousGetHandle() ?? OffscreenSurface;

            if (!_egl.MakeCurrent(_disp.Handle, surf, surf, Context))
            {
                throw new OpenGlException("eglMakeCurrent failed");
            }
        }
 public RenderTarget(EglDisplay display, EglContext context,
                     EglSurface glSurface, IEglWindowGlPlatformSurfaceInfo info)
 {
     _display     = display;
     _context     = context;
     _glSurface   = glSurface;
     _info        = info;
     _initialSize = info.Size;
 }
Example #6
0
 public Session(EglDisplay display, EglContext context,
                EglSurface glSurface, IEglWindowGlPlatformSurfaceInfo info,
                IDisposable @lock, IDisposable restoreContext)
 {
     _context        = context;
     _display        = display;
     _glSurface      = glSurface;
     _info           = info;
     _lock           = @lock;
     _restoreContext = restoreContext;
 }
Example #7
0
        public IDisposable MakeCurrent(EglSurface surface)
        {
            var old  = new RestoreContext(_egl, _disp.Handle);
            var surf = surface ?? OffscreenSurface;

            _egl.MakeCurrent(_disp.Handle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
            if (!_egl.MakeCurrent(_disp.Handle, surf.DangerousGetHandle(), surf.DangerousGetHandle(), Context))
            {
                throw OpenGlException.GetFormattedException("eglMakeCurrent", _egl);
            }
            return(old);
        }
Example #8
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);
        }
Example #9
0
 public EglContext(EglDisplay display, EglInterface egl, IntPtr ctx, EglSurface offscreenSurface,
                   GlVersion version, int sampleCount, int stencilSize)
 {
     _disp            = display;
     _egl             = egl;
     Context          = ctx;
     OffscreenSurface = offscreenSurface;
     Version          = version;
     SampleCount      = sampleCount;
     StencilSize      = stencilSize;
     using (MakeCurrent())
         GlInterface = GlInterface.FromNativeUtf8GetProcAddress(version, b => _egl.GetProcAddress(b));
 }
 public Session(EglDisplay display, EglContext context,
                EglSurface glSurface, EglGlPlatformSurfaceBase.IEglWindowGlPlatformSurfaceInfo info,
                IDisposable @lock, IDisposable restoreContext, Action onFinish, bool isYFlipped)
 {
     IsYFlipped      = isYFlipped;
     _context        = context;
     _display        = display;
     _glSurface      = glSurface;
     _info           = info;
     _lock           = @lock;
     _restoreContext = restoreContext;
     _onFinish       = onFinish;
 }
        protected IGlPlatformSurfaceRenderingSession BeginDraw(EglSurface surface,
                                                               EglGlPlatformSurfaceBase.IEglWindowGlPlatformSurfaceInfo info, Action onFinish = null, bool isYFlipped = false)
        {
            var l = _context.Lock();

            try
            {
                if (IsCorrupted)
                {
                    throw new RenderTargetCorruptedException();
                }
                var restoreContext = _context.MakeCurrent(surface);
                _display.EglInterface.WaitClient();
                _display.EglInterface.WaitGL();
                _display.EglInterface.WaitNative(EglConsts.EGL_CORE_NATIVE_ENGINE);

                return(new Session(_display, _context, surface, info, l, restoreContext, onFinish, isYFlipped));
            }
            catch
            {
                l.Dispose();
                throw;
            }
        }
Example #12
0
 public RenderTarget(EglContext context, EglSurface glSurface, IEglWindowGlPlatformSurfaceInfo info)
 {
     _context   = context;
     _glSurface = glSurface;
     _info      = info;
 }