public EglContext CreateContext(IGlContext share) { if (share != null && !SupportsSharing) { throw new NotSupportedException("Context sharing is not supported by this display"); } 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, shareCtx, ctx, context => new EglSurface(this, context, surf), _version, _sampleCount, _stencilSize); return(rv); }
public Session(EglDisplay display, EglContext context, EglSurface glSurface, EglGlPlatformSurfaceBase.IEglWindowGlPlatformSurfaceInfo info, IDisposable restoreContext, Action onFinish, bool isYFlipped) { IsYFlipped = isYFlipped; _context = context; _display = display; _glSurface = glSurface; _info = info; _restoreContext = restoreContext; _onFinish = onFinish; }
public EglContext(EglDisplay display, EglInterface egl, EglContext sharedWith, IntPtr ctx, Func <EglContext, EglSurface> offscreenSurface, GlVersion version, int sampleCount, int stencilSize) { _disp = display; _egl = egl; _sharedWith = sharedWith; Context = ctx; OffscreenSurface = offscreenSurface(this); Version = version; SampleCount = sampleCount; StencilSize = stencilSize; using (MakeCurrent()) GlInterface = GlInterface.FromNativeUtf8GetProcAddress(version, b => _egl.GetProcAddress(b)); }
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); }
public EglPlatformOpenGlInterface(EglDisplay display) { Display = display; PrimaryEglContext = display.CreateContext(null); }
public EglSurface(EglDisplay display, EglContext context, IntPtr surface) : base(surface, true) { _display = display; _context = context; _egl = display.EglInterface; }