screencast: Fix GLES path

glReadPixels reads from the bound framebuffer, so create an offscreen
framebuffer and attach the texture to it

Co-authored-by: Jan Grulich <jgrulich@redhat.com>
This commit is contained in:
Alessandro Astone 2023-11-15 23:22:56 +01:00
parent 4cdf27e74c
commit 491a5b386b

View file

@ -60,7 +60,10 @@ static void doGrabTexture(GLTexture *texture, spa_data *spa, spa_video_format fo
texture->bind();
if (GLPlatform::instance()->isGLES()) {
GLFramebuffer fbo(texture);
GLFramebuffer::pushFramebuffer(&fbo);
glReadPixels(0, 0, size.width(), size.height(), closestGLType(format), GL_UNSIGNED_BYTE, spa->data);
GLFramebuffer::popFramebuffer();
} else if (GLPlatform::instance()->glVersion() >= Version(4, 5)) {
glGetTextureImage(texture->texture(), 0, closestGLType(format), GL_UNSIGNED_BYTE, spa->chunk->size, spa->data);
} else {