mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-26 04:32:47 -04:00
fix(texture): convert unsupported format in glReadPixels, fix crash on Xaero's WorldMap
This commit is contained in:
parent
e526ea0dab
commit
e843bf0262
@ -104,7 +104,7 @@ NATIVE_FUNCTION_HEAD(void, glLineWidth, GLfloat width) NATIVE_FUNCTION_END_NO_RE
|
||||
//NATIVE_FUNCTION_HEAD(void, glLinkProgram, GLuint program) NATIVE_FUNCTION_END_NO_RETURN(void, glLinkProgram, program)
|
||||
NATIVE_FUNCTION_HEAD(void, glPixelStorei, GLenum pname, GLint param) NATIVE_FUNCTION_END_NO_RETURN(void, glPixelStorei, pname,param)
|
||||
NATIVE_FUNCTION_HEAD(void, glPolygonOffset, GLfloat factor, GLfloat units) NATIVE_FUNCTION_END_NO_RETURN(void, glPolygonOffset, factor,units)
|
||||
NATIVE_FUNCTION_HEAD(void, glReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels) NATIVE_FUNCTION_END_NO_RETURN(void, glReadPixels, x,y,width,height,format,type,pixels)
|
||||
//NATIVE_FUNCTION_HEAD(void, glReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels) NATIVE_FUNCTION_END_NO_RETURN(void, glReadPixels, x,y,width,height,format,type,pixels)
|
||||
NATIVE_FUNCTION_HEAD(void, glReleaseShaderCompiler) NATIVE_FUNCTION_END_NO_RETURN(void, glReleaseShaderCompiler)
|
||||
//NATIVE_FUNCTION_HEAD(void, glRenderbufferStorage, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) NATIVE_FUNCTION_END_NO_RETURN(void, glRenderbufferStorage, target,internalformat,width,height)
|
||||
NATIVE_FUNCTION_HEAD(void, glSampleCoverage, GLfloat value, GLboolean invert) NATIVE_FUNCTION_END_NO_RETURN(void, glSampleCoverage, value,invert)
|
||||
|
@ -775,4 +775,21 @@ void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void*
|
||||
|
||||
glDeleteFramebuffers(1, &fbo);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, prevFBO);
|
||||
}
|
||||
}
|
||||
|
||||
void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels) {
|
||||
LOG()
|
||||
LOAD_GLES_FUNC(glReadPixels)
|
||||
|
||||
LOG_D("glReadPixels, x=%d, y=%d, width=%d, height=%d, format=0x%x, type=0x%x, pixels=0x%x",
|
||||
x, y, width, height, format, type, pixels)
|
||||
|
||||
if (format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) {
|
||||
format = GL_RGBA;
|
||||
type = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
LOG_D("glReadPixels converted, x=%d, y=%d, width=%d, height=%d, format=0x%x, type=0x%x, pixels=0x%x",
|
||||
x, y, width, height, format, type, pixels)
|
||||
gles_glReadPixels(x, y, width, height, format, type, pixels);
|
||||
CHECK_GL_ERROR
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ GLAPI GLAPIENTRY void glGenerateTextureMipmap(GLuint texture);
|
||||
GLAPI GLAPIENTRY void glBindTexture(GLenum target, GLuint texture);
|
||||
GLAPI GLAPIENTRY void glDeleteTextures(GLsizei n, const GLuint *textures);
|
||||
GLAPI GLAPIENTRY void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void* pixels);
|
||||
GLAPI GLAPIENTRY void glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user