From: Steinar H. Gunderson Date: Tue, 2 Oct 2012 09:46:46 +0000 (+0200) Subject: Slight cleanup in texture upload format selection. X-Git-Tag: 1.0~437 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=7ead6f1c15daf8e5a70df583198a8ce58251b0d6 Slight cleanup in texture upload format selection. --- diff --git a/effect_chain.cpp b/effect_chain.cpp index 85832db..4dfa692 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -213,7 +213,12 @@ void EffectChain::render_to_screen(unsigned char *src) assert(false); } - glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, GL_UNSIGNED_BYTE, src); + static bool first = true; + if (first) { + glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, height, 0, format, GL_UNSIGNED_BYTE, src); + } else { + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, 0, format, GL_UNSIGNED_BYTE, src); + } check_error(); glUniform1i(glGetUniformLocation(glsl_program_num, "input_tex"), 0);