diff --git a/src/main/cpp/gl/gl_native.c b/src/main/cpp/gl/gl_native.c index 67b5afa..08dda26 100644 --- a/src/main/cpp/gl/gl_native.c +++ b/src/main/cpp/gl/gl_native.c @@ -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) diff --git a/src/main/cpp/gl/texture.cpp b/src/main/cpp/gl/texture.cpp index eb7d54a..8368c14 100644 --- a/src/main/cpp/gl/texture.cpp +++ b/src/main/cpp/gl/texture.cpp @@ -775,4 +775,21 @@ void glGetTexImage(GLenum target, GLint level, GLenum format, GLenum type, void* glDeleteFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, prevFBO); -} \ No newline at end of file +} + +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 +} diff --git a/src/main/cpp/gl/texture.h b/src/main/cpp/gl/texture.h index ba1a165..c82330c 100644 --- a/src/main/cpp/gl/texture.h +++ b/src/main/cpp/gl/texture.h @@ -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 }