Skip to content

Commit

Permalink
Adjust GL3 ReadFrame() for GL ES 2.1 compatibility.
Browse files Browse the repository at this point in the history
Currently on Win32 this errors out and renders a black rectangle.
  • Loading branch information
whitequark committed May 20, 2019
1 parent c18deb2 commit 11c5cdc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/render/rendergl3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 11c5cdc

Please sign in to comment.