Bumping this with some more information:
Here is how we're configuring OpenGL in Android:
EGLint att[] = {
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_ALPHA_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_RED_SIZE, 8,
EGL_DEPTH_SIZE, 0,
EGL_STENCIL_SIZE, 0,
EGL_NONE
};
This is how we're configuring the Skia surface
GLint buffer;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &buffer);
GLint stencil;
glGetIntegerv(GL_STENCIL_BITS, &stencil);
GLint samples;
glGetIntegerv(GL_SAMPLES, &samples);
auto maxSamples = _skContext->maxSurfaceSampleCountForColorType(kRGBA_8888_SkColorType);
if (samples > maxSamples)
samples = maxSamples;
GrGLFramebufferInfo fbInfo;
fbInfo.fFBOID = buffer;
fbInfo.fFormat = 0x8058;
_skRenderTarget = GrBackendRenderTarget(_width, _height, samples, stencil, fbInfo);
_skSurface = SkSurface::MakeFromBackendRenderTarget(
_skContext.get(), _skRenderTarget, kBottomLeft_GrSurfaceOrigin,
kRGBA_8888_SkColorType, nullptr, nullptr);
When testing clearing the screen with OpenGL we get the correct colors on the screen.
Drawing shaders with Skia works correctly, while using drawing primitives like canvas.drawPaint renders only black colors.
Any idea why this is happening?
Christian