]> git.sesse.net Git - movit/commitdiff
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 55c65cc329181e0281b07184c8758eac73477f03..5978ca3b51c4116441933537a6168707f210d44a 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;