mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-22 10:42:11 -04:00
fix(texture): glGetTexImage readback BGRA texture
This commit is contained in:
parent
68700c1fcb
commit
34aed04e70
@ -793,17 +793,18 @@ void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void*
|
|||||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||||
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||||
|
|
||||||
// if (format == GL_BGRA && (type == GL_UNSIGNED_INT_8_8_8_8 || type == GL_UNSIGNED_INT_8_8_8_8_REV)) {
|
if (pixels != NULL && format == GL_BGRA && (type == GL_UNSIGNED_INT_8_8_8_8 || type == GL_UNSIGNED_INT_8_8_8_8_REV)) {
|
||||||
// void *read_pixels = malloc(width * height * 4);
|
void *read_pixels = malloc(width * height * 4);
|
||||||
// glReadPixels(0, 0, width, height, format, type, read_pixels);
|
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, read_pixels);
|
||||||
// pixel_convert(read_pixels, &pixels, width, height, GL_RGBA, GL_UNSIGNED_BYTE, format, GL_UNSIGNED_BYTE, 0, 1);
|
pixel_convert(read_pixels, &pixels, width, height, GL_RGBA, GL_UNSIGNED_BYTE, format, GL_UNSIGNED_BYTE, 0, 1);
|
||||||
// free(read_pixels);
|
free(read_pixels);
|
||||||
// } else {
|
} else {
|
||||||
// glReadPixels(0, 0, width, height, format, type, pixels);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
glReadPixels(0, 0, width, height, format, type, pixels);
|
glReadPixels(0, 0, width, height, format, type, pixels);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// glReadPixels(0, 0, width, height, format, type, pixels);
|
||||||
|
|
||||||
glPixelStorei(GL_PACK_ALIGNMENT, oldPackAlignment);
|
glPixelStorei(GL_PACK_ALIGNMENT, oldPackAlignment);
|
||||||
glViewport(oldViewport[0], oldViewport[1], oldViewport[2], oldViewport[3]);
|
glViewport(oldViewport[0], oldViewport[1], oldViewport[2], oldViewport[3]);
|
||||||
glDeleteFramebuffers(1, &fbo);
|
glDeleteFramebuffers(1, &fbo);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user