From bd98e07fa5ba3cb783e8e9d16ab4cc93a9fa3100 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 20 Mar 2014 21:15:13 +0100 Subject: [PATCH] Use the right internal format for FORMAT_R non-float textures. --- flat_input.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; -- 2.39.2