Use the right internal format for FORMAT_R non-float textures.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 20 Mar 2014 20:15:13 +0000 (21:15 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 20 Mar 2014 20:43:46 +0000 (21:43 +0100)
flat_input.cpp

index 55c65cc..5978ca3 100644 (file)
@@ -74,7 +74,13 @@ void FlatInput::set_gl_state(GLuint glsl_program_num, const string& prefix, unsi
                        internal_format = GL_SRGB8_ALPHA8;
                } else {
                        assert(type == GL_UNSIGNED_BYTE);
-                       internal_format = GL_RGBA8;
+                       if (pixel_format == FORMAT_R) {
+                               internal_format = GL_R8;
+                       } else if (pixel_format == FORMAT_RG) {
+                               internal_format = GL_RG8;
+                       } else {
+                               internal_format = GL_RGBA8;
+                       }
                }
                if (pixel_format == FORMAT_RGB) {
                        format = GL_RGB;