Skip to content

Commit

Permalink
Fallback to glReadPixels if glReadnPixels is unavailable.
Browse files Browse the repository at this point in the history
`glReadnPixels` was added in GLES 3.2, so it is not available on
older devices.
  • Loading branch information
pmuetschard committed Mar 1, 2019
1 parent e4f4637 commit c1ab62f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gapii/cc/gles_mid_execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,13 @@ ImageData Reader::ReadPixels(GLsizei w, GLsizei h) {
img.height = h;
img.data.reset(new std::vector<uint8_t>(size));
GAPID_DEBUG("ReadPixels: Reading %dx%d at %d bytes", w, h, size);
imports.glReadnPixels(0, 0, w, h, img.dataFormat, img.dataType,
img.data->size(), img.data->data());
if (imports.glReadnPixels) {
imports.glReadnPixels(0, 0, w, h, img.dataFormat, img.dataType,
img.data->size(), img.data->data());
} else {
imports.glReadPixels(0, 0, w, h, img.dataFormat, img.dataType,
img.data->data());
}
CHECK_GL_ERROR("ReadPixels: Failed to read pixels");
return img;
}
Expand Down

0 comments on commit c1ab62f

Please sign in to comment.