diff --git a/project/jni/glshim/src/gl/framebuffers.c b/project/jni/glshim/src/gl/framebuffers.c index c1a43b1ef..f43dc9f37 100755 --- a/project/jni/glshim/src/gl/framebuffers.c +++ b/project/jni/glshim/src/gl/framebuffers.c @@ -292,6 +292,15 @@ void glshim_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum r return; } + if ((current_fb!=0) && (renderbuffer!=0) && ((attachment==GL_DEPTH_ATTACHMENT) || (attachment==GL_STENCIL_ATTACHMENT))) { + GLuint tmp; + gles_glGetFramebufferAttachmentParameteriv(target, attachment, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &tmp); + if (tmp==renderbuffer) { + noerrorShim(); + return; + } + } + errorGL(); gles_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); } diff --git a/project/jni/glshim/src/gl/pixel.c b/project/jni/glshim/src/gl/pixel.c index 4d3a1cf9f..c3fae5482 100755 --- a/project/jni/glshim/src/gl/pixel.c +++ b/project/jni/glshim/src/gl/pixel.c @@ -828,7 +828,7 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst, if ((src_format == GL_RGBA) && (dst_format == GL_RGBA) && (dst_type == GL_UNSIGNED_SHORT_5_5_5_1) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { - *(GLushort*)dst_pos = ((GLushort)(((char*)src_pos)[2]&0xf8)>>(3-1)) | ((GLushort)(((char*)src_pos)[1]&0xf8)<<(5-2)) | ((GLushort)(((char*)src_pos)[0]&0xf8)<<(10-2)) | ((GLushort)(((char*)src_pos)[3]>0)?1:0); + *(GLushort*)dst_pos = ((GLushort)(((char*)src_pos)[2]&0xf8)>>(3-1)) | ((GLushort)(((char*)src_pos)[1]&0xf8)<<(5-2)) | ((GLushort)(((char*)src_pos)[0]&0xf8)<<(10-2)) | ((GLushort)(((char*)src_pos)[3])>>15); src_pos += src_stride; dst_pos += dst_stride; } @@ -840,7 +840,7 @@ bool pixel_convert(const GLvoid *src, GLvoid **dst, if ((src_format == GL_BGRA) && (dst_format == GL_RGBA) && (dst_type == GL_UNSIGNED_SHORT_5_5_5_1) && ((src_type == GL_UNSIGNED_BYTE)||(src_type == GL_UNSIGNED_INT_8_8_8_8_REV))) { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { - *(GLushort*)dst_pos = ((GLushort)(((char*)src_pos)[0]&0xf8)>>(3-1)) | ((GLushort)(((char*)src_pos)[1]&0xf8)<<(5-2)) | ((GLushort)(((char*)src_pos)[2]&0xf8)<<(10-2)) | ((GLushort)(((char*)src_pos)[3]>0)?1:0); + *(GLushort*)dst_pos = ((GLushort)(((char*)src_pos)[0]&0xf8)>>(3-1)) | ((GLushort)(((char*)src_pos)[1]&0xf8)<<(5-2)) | ((GLushort)(((char*)src_pos)[2]&0xf8)<<(10-2)) | ((GLushort)(((char*)src_pos)[3])>>15); src_pos += src_stride; dst_pos += dst_stride; } diff --git a/project/jni/glshim/src/gl/texture.c b/project/jni/glshim/src/gl/texture.c index 8429c31aa..aed3afe37 100755 --- a/project/jni/glshim/src/gl/texture.c +++ b/project/jni/glshim/src/gl/texture.c @@ -122,6 +122,10 @@ static int is_fake_compressed_rgba(GLenum internalformat) void internal2format_type(GLenum internalformat, GLenum *format, GLenum *type) { switch(internalformat) { + case GL_ALPHA: + *format = GL_ALPHA; + *type = GL_UNSIGNED_BYTE; + break; case GL_LUMINANCE: *format = GL_LUMINANCE; *type = GL_UNSIGNED_BYTE; @@ -151,7 +155,7 @@ void internal2format_type(GLenum internalformat, GLenum *format, GLenum *type) *type = GL_UNSIGNED_BYTE; break; default: - printf("LIBGL: Warning, unknonw Internalformat (%s)\n", PrintEnum(internalformat)); + printf("LIBGL: Warning, unknown Internalformat (%s)\n", PrintEnum(internalformat)); *format = GL_RGBA; *type = GL_UNSIGNED_BYTE; break;