diff --git a/src/image.cpp b/src/image.cpp index 5bb9229c..b38637d7 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -1413,7 +1413,7 @@ namespace bgfx { float rgba[4]; unpack(rgba, &src[xx*srcBpp/8]); - pack(&dst[xx*srcBpp/8], rgba); + pack(&dst[xx*dstBpp/8], rgba); } } diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index eea33f9f..44b73e2d 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -260,9 +260,9 @@ namespace bgfx { namespace gl { GL_RGBA32I, GL_ZERO, GL_RGBA, GL_INT, false }, // RGBA32I { GL_RGBA32UI, GL_ZERO, GL_RGBA, GL_UNSIGNED_INT, false }, // RGBA32U { GL_RGBA32F, GL_ZERO, GL_RGBA, GL_FLOAT, false }, // RGBA32F - { GL_RGB565, GL_ZERO, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, false }, // R5G6B5 - { GL_RGBA4, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, false }, // RGBA4 - { GL_RGB5_A1, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, false }, // RGB5A1 + { GL_RGB565, GL_ZERO, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, false }, // R5G6B5 + { GL_RGBA4, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV, false }, // RGBA4 + { GL_RGB5_A1, GL_ZERO, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV, false }, // RGB5A1 { GL_RGB10_A2, GL_ZERO, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, false }, // RGB10A2 { GL_R11F_G11F_B10F, GL_ZERO, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, false }, // R11G11B10F { GL_ZERO, GL_ZERO, GL_ZERO, GL_ZERO, false }, // UnknownDepth @@ -1519,9 +1519,9 @@ namespace bgfx { namespace gl // internalFormat and format must match: // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glTexImage2D.xml setTextureFormat(TextureFormat::RGBA8, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE); - setTextureFormat(TextureFormat::R5G6B5, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5); - setTextureFormat(TextureFormat::RGBA4, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4); - setTextureFormat(TextureFormat::RGB5A1, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1); + setTextureFormat(TextureFormat::R5G6B5, GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV); + setTextureFormat(TextureFormat::RGBA4, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4_REV); + setTextureFormat(TextureFormat::RGB5A1, GL_RGBA, GL_RGBA, GL_UNSIGNED_SHORT_1_5_5_5_REV); if (s_extension[Extension::OES_texture_half_float].m_supported || s_extension[Extension::OES_texture_float ].m_supported) diff --git a/tools/texturec/texturec.cpp b/tools/texturec/texturec.cpp index 4233c165..13eab90d 100644 --- a/tools/texturec/texturec.cpp +++ b/tools/texturec/texturec.cpp @@ -132,6 +132,7 @@ namespace bgfx break; default: + imageConvert(_dst, format, _src, TextureFormat::RGBA8, _width, _height); break; } }