Fix bloom shader missing its target

This commit is contained in:
Magnus Norddahl 2016-08-12 17:44:59 +02:00 committed by Christoph Oelckers
commit 210fce1193
8 changed files with 26 additions and 8 deletions

View file

@ -139,7 +139,7 @@ void FGLRenderBuffers::DeleteFrameBuffer(GLuint &handle)
//
//==========================================================================
void FGLRenderBuffers::Setup(int width, int height)
void FGLRenderBuffers::Setup(int width, int height, int sceneWidth, int sceneHeight)
{
if (!IsEnabled())
return;
@ -151,16 +151,23 @@ void FGLRenderBuffers::Setup(int width, int height)
CreateScene(mWidth, mHeight, samples);
mSamples = samples;
}
else if (width > mWidth || height > mHeight)
else if (width != mWidth || height != mHeight)
{
CreatePipeline(width, height);
CreateScene(width, height, samples);
CreateBloom(width, height);
mWidth = width;
mHeight = height;
mSamples = samples;
}
// Bloom bluring buffers need to match the scene to avoid bloom bleeding artifacts
if (mBloomWidth != sceneWidth || mBloomHeight != sceneHeight)
{
CreateBloom(sceneWidth, sceneHeight);
mBloomWidth = sceneWidth;
mBloomHeight = sceneHeight;
}
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
glBindRenderbuffer(GL_RENDERBUFFER, 0);