Do not store RGB textures with RGBA internal format.
[movit] / resource_pool.cpp
index 0557751..9beae1b 100644 (file)
@@ -186,8 +186,14 @@ GLuint ResourcePool::create_2d_texture(GLint internal_format, GLsizei width, GLs
        case GL_SRGB8_ALPHA8:
                format = GL_RGBA;
                break;
+       case GL_RGB32F:
+       case GL_RGB16F:
+       case GL_RGB8:
+               format = GL_RGB;
+               break;
        case GL_RG32F:
        case GL_RG16F:
+       case GL_RG8:
                format = GL_RG;
                break;
        case GL_R32F:
@@ -205,14 +211,18 @@ GLuint ResourcePool::create_2d_texture(GLint internal_format, GLsizei width, GLs
        switch (internal_format) {
        case GL_RGBA32F_ARB:
        case GL_RGBA16F_ARB:
+       case GL_RGB32F:
+       case GL_RGB16F:
        case GL_RG32F:
        case GL_RG16F:
        case GL_R32F:
        case GL_R16F:
                type = GL_FLOAT;
                break;
-       case GL_RGBA8:
        case GL_SRGB8_ALPHA8:
+       case GL_RGBA8:
+       case GL_RGB8:
+       case GL_RG8:
        case GL_R8:
                type = GL_UNSIGNED_BYTE;
                break;
@@ -273,10 +283,20 @@ size_t ResourcePool::estimate_texture_size(const Texture2D &texture_format)
        case GL_RGBA16F_ARB:
                bytes_per_pixel = 8;
                break;
+       case GL_RGB32F_ARB:
+               bytes_per_pixel = 12;
+               break;
+       case GL_RGB16F_ARB:
+               bytes_per_pixel = 6;
+               break;
        case GL_RGBA8:
        case GL_SRGB8_ALPHA8:
                bytes_per_pixel = 4;
                break;
+       case GL_RGB8:
+       case GL_SRGB8:
+               bytes_per_pixel = 3;
+               break;
        case GL_RG32F:
                bytes_per_pixel = 8;
                break;