diff --git a/src/plugins/screencast/screencastutils.h b/src/plugins/screencast/screencastutils.h index d7f5439e14..70387dfca0 100644 --- a/src/plugins/screencast/screencastutils.h +++ b/src/plugins/screencast/screencastutils.h @@ -57,12 +57,14 @@ static void doGrabTexture(GLTexture *texture, QImage *target) if (context->isOpenGLES() || context->glPlatform()->driver() == Driver_NVidia) { GLFramebuffer fbo(texture); GLFramebuffer::pushFramebuffer(&fbo); - glReadPixels(0, 0, size.width(), size.height(), closestGLType(target->format()), GL_UNSIGNED_BYTE, target->bits()); + context->glReadnPixels(0, 0, size.width(), size.height(), closestGLType(target->format()), GL_UNSIGNED_BYTE, target->sizeInBytes(), target->bits()); GLFramebuffer::popFramebuffer(); - } else if (context->openglVersion() >= Version(4, 5)) { - glGetTextureImage(texture->texture(), 0, closestGLType(target->format()), GL_UNSIGNED_BYTE, target->sizeInBytes(), target->bits()); } else { - glGetTexImage(texture->target(), 0, closestGLType(target->format()), GL_UNSIGNED_BYTE, target->bits()); + if (context->openglVersion() >= Version(4, 5)) { + glGetnTexImage(texture->target(), 0, closestGLType(target->format()), GL_UNSIGNED_BYTE, target->sizeInBytes(), target->bits()); + } else { + glGetTexImage(texture->target(), 0, closestGLType(target->format()), GL_UNSIGNED_BYTE, target->bits()); + } } if (invertNeededAndSupported) {