Skip to content

Commit 961777c

Browse files
authored
Merge pull request #43 from alexytomi/bgra-swizzle
[Fix] (texture): Swizzle BGRA to RGBA for glTexSubImage2D
2 parents 694dfc2 + 1ef9866 commit 961777c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

MobileGlues-cpp/gl/texture.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,10 @@ void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, G
990990
glEnumToString(target), level, xoffset, yoffset, width, height, glEnumToString(format), glEnumToString(type),
991991
pixels)
992992

993-
if (format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8) {
993+
if (format == GL_BGRA && (type == GL_UNSIGNED_INT_8_8_8_8 || type == GL_UNSIGNED_INT_8_8_8_8_REV)) {
994+
glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
995+
glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_RED);
996+
994997
format = GL_RGBA;
995998
type = GL_UNSIGNED_BYTE;
996999
}

0 commit comments

Comments
 (0)