Adjust GL3 ReadFrame() for GL ES 2.1 compatibility.

Currently on Win32 this errors out and renders a black rectangle.
pull/420/head
whitequark 2019-05-20 19:05:58 +00:00
parent c18deb2d81
commit 11c5cdc7b0
1 changed files with 3 additions and 2 deletions

View File

@ -680,9 +680,10 @@ void OpenGl3Renderer::Clear() {
std::shared_ptr<Pixmap> OpenGl3Renderer::ReadFrame() {
std::shared_ptr<Pixmap> 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;
}