From 156c1edd2b74f5c07d2aa3ef5e87c0cf206e5f02 Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Sat, 7 May 2022 20:17:02 -0700 Subject: [PATCH] ui: Use glReadPixels instead of glReadnPixels for screenshot macOS doesn't support glReadnPixels. --- ui/xui/gl-helpers.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ui/xui/gl-helpers.cc b/ui/xui/gl-helpers.cc index 34f04b9395..e763acc2ff 100644 --- a/ui/xui/gl-helpers.cc +++ b/ui/xui/gl-helpers.cc @@ -717,7 +717,7 @@ void SaveScreenshot(GLuint tex, bool flip) } std::vector pixels; - pixels.resize(width * height * 4); + pixels.resize(width * height * 3); Fbo fbo(width, height); fbo.Target(); @@ -728,8 +728,7 @@ void SaveScreenshot(GLuint tex, bool flip) glPixelStorei(GL_PACK_ROW_LENGTH, width); glPixelStorei(GL_PACK_IMAGE_HEIGHT, height); glPixelStorei(GL_PACK_ALIGNMENT, 1); - glReadnPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels.size(), - pixels.data()); + glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels.data()); fbo.Restore(); char fname[128];