From 8670fd459c10308dce147fa5b59e97f9a74f8e02 Mon Sep 17 00:00:00 2001 From: Luke Benstead Date: Thu, 20 Sep 2018 15:10:08 +0100 Subject: [PATCH] More conversions --- GL/texture.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/GL/texture.c b/GL/texture.c index ceb7511..01d35af 100644 --- a/GL/texture.c +++ b/GL/texture.c @@ -473,6 +473,15 @@ static void _rgba8888_to_rgba8888(const GLubyte* source, GLushort* dest) { dst[3] = source[3]; } +static void _rgb888_to_rgba8888(const GLubyte* source, GLushort* dest) { + /* Noop */ + GLubyte* dst = (GLubyte*) dest; + dst[0] = source[0]; + dst[1] = source[1]; + dst[2] = source[2]; + dst[3] = 255; +} + static void _rgb888_to_rgb565(const GLubyte* source, GLushort* dest) { *dest = ((source[0] & 0b11111000) << 8) | ((source[1] & 0b11111100) << 3) | (source[2] >> 3); } @@ -538,6 +547,10 @@ static TextureConversionFunc _determineConversion(GLint internalFormat, GLenum f return _rgba8888_to_rgba8888; } else if (type == GL_BYTE && format == GL_RGBA) { return _rgba8888_to_rgba8888; + } else if(type == GL_UNSIGNED_BYTE && format == GL_RGB) { + return _rgb888_to_rgba8888; + } else if (type == GL_BYTE && format == GL_RGB) { + return _rgb888_to_rgba8888; } else if(type == GL_UNSIGNED_SHORT_4_4_4_4 && format == GL_RGBA) { return _rgba4444_to_rgba8888; }