From 6c5109ec9949bf60e94b893f6fbc594d836cad82 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 27 Aug 2016 06:24:36 +0200 Subject: [PATCH] Fix uninitialized mPipelineTexture and fix BindCurrentTexture using the wrong handle --- src/gl/renderer/gl_renderbuffers.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gl/renderer/gl_renderbuffers.cpp b/src/gl/renderer/gl_renderbuffers.cpp index 9c9c76979c..9f27e63136 100644 --- a/src/gl/renderer/gl_renderbuffers.cpp +++ b/src/gl/renderer/gl_renderbuffers.cpp @@ -65,6 +65,12 @@ CVAR(Bool, gl_renderbuffers, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); FGLRenderBuffers::FGLRenderBuffers() { + for (int i = 0; i < NumPipelineTextures; i++) + { + mPipelineTexture[i] = 0; + mPipelineFB[i] = 0; + } + glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*)&mOutputFB); glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples); } @@ -477,7 +483,7 @@ void FGLRenderBuffers::BindSceneFB() void FGLRenderBuffers::BindCurrentTexture(int index) { glActiveTexture(GL_TEXTURE0 + index); - glBindTexture(GL_TEXTURE_2D, mPipelineFB[mCurrentPipelineTexture]); + glBindTexture(GL_TEXTURE_2D, mPipelineTexture[mCurrentPipelineTexture]); } //==========================================================================