From 11c5cdc7b08fe343ccbc9ffaf95d9f9c6d7d6016 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 20 May 2019 19:05:58 +0000 Subject: [PATCH] Adjust GL3 ReadFrame() for GL ES 2.1 compatibility. Currently on Win32 this errors out and renders a black rectangle. --- src/render/rendergl3.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/render/rendergl3.cpp b/src/render/rendergl3.cpp index 167ce035..ce201aca 100644 --- a/src/render/rendergl3.cpp +++ b/src/render/rendergl3.cpp @@ -680,9 +680,10 @@ void OpenGl3Renderer::Clear() { std::shared_ptr OpenGl3Renderer::ReadFrame() { std::shared_ptr pixmap = - Pixmap::Create(Pixmap::Format::RGB, (size_t)camera.width, (size_t)camera.height); + Pixmap::Create(Pixmap::Format::RGBA, (size_t)camera.width, (size_t)camera.height); glReadPixels(0, 0, (int)camera.width, (int)camera.height, - GL_RGB, GL_UNSIGNED_BYTE, &pixmap->data[0]); + GL_RGBA, GL_UNSIGNED_BYTE, &pixmap->data[0]); + ssassert(glGetError() == GL_NO_ERROR, "Unexpected glReadPixels error"); return pixmap; }