From: Steinar H. Gunderson Date: Thu, 20 Mar 2014 20:15:13 +0000 (+0100) Subject: Use the right internal format for FORMAT_R non-float textures. X-Git-Tag: 1.1~12^2~24 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=bd98e07fa5ba3cb783e8e9d16ab4cc93a9fa3100;hp=ab89030be6f55cd1955b9e033c62c2e3c3ba2a2f Use the right internal format for FORMAT_R non-float textures. --- diff --git a/flat_input.cpp b/flat_input.cpp index 55c65cc..5978ca3 100644 --- a/flat_input.cpp +++ b/flat_input.cpp @@ -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;