public void OnSurfaceCreated(IGL10 gl, EGLConfig config) { FreeContext(); // get the config var egl = EGLContext.EGL.JavaCast <IEGL10>(); var disp = egl.EglGetCurrentDisplay(); // stencil buffers int[] stencilbuffers = new int[1]; egl.EglGetConfigAttrib(disp, config, EGL10.EglStencilSize, stencilbuffers); // samples int[] samples = new int[1]; egl.EglGetConfigAttrib(disp, config, EGL10.EglSamples, samples); // get the frame buffer int[] framebuffers = new int[1]; gl.GlGetIntegerv(GLES20.GlFramebufferBinding, framebuffers, 0); // create the render target renderTarget = new GRBackendRenderTargetDesc { Width = 0, // set later Height = 0, // set later Config = GRPixelConfig.Rgba8888, Origin = GRSurfaceOrigin.BottomLeft, SampleCount = samples[0], StencilBits = stencilbuffers[0], RenderTargetHandle = (IntPtr)framebuffers[0], }; CreateContext(); }
void GLSurfaceView.IRenderer.OnSurfaceCreated(IGL10 gl, EGLConfig config) { FreeContext(); // get the config var egl = EGLContext.EGL.JavaCast <IEGL10>(); var disp = egl.EglGetCurrentDisplay(); // stencil buffers int[] stencilbuffers = new int[1]; egl.EglGetConfigAttrib(disp, config, EGL10.EglStencilSize, stencilbuffers); // samples int[] samples = new int[1]; egl.EglGetConfigAttrib(disp, config, EGL10.EglSamples, samples); // get the frame buffer int[] framebuffers = new int[1]; gl.GlGetIntegerv(GLES20.GlFramebufferBinding, framebuffers, 0); // create the SkiaSharp context var glInterface = GRGlInterface.CreateNativeGlInterface(); context = GRContext.Create(GRBackend.OpenGL, glInterface); // create the render target renderTarget = new GRBackendRenderTargetDesc { Width = 0, // set later Height = 0, // set later Config = GRPixelConfig.Rgba8888, Origin = GRSurfaceOrigin.TopLeft, SampleCount = samples[0], StencilBits = stencilbuffers[0], RenderTargetHandle = (IntPtr)framebuffers[0], }; }