From 2e4309fd8af9ca0a3656a584f8ed8b3fc634263f Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 2 Oct 2012 11:48:34 +0200 Subject: [PATCH] Use glTexSubImage2D on second and later uploads. --- effect_chain.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/effect_chain.cpp b/effect_chain.cpp index 85832db..0f2e69d 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, format, GL_UNSIGNED_BYTE, src); + } check_error(); glUniform1i(glGetUniformLocation(glsl_program_num, "input_tex"), 0); -- 2.39.2