From efc1347c570d3d8ab0c4aef6d99f940d384b2ecb Mon Sep 17 00:00:00 2001 From: divverent Date: Fri, 25 Nov 2011 13:13:02 +0000 Subject: [PATCH] fix r_bloom_colorexponent with fbo (fixed version doesn't support npot exponents, but non fixed version does them wrong too) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11570 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gl_rmain.c b/gl_rmain.c index 28b8efe8..fa02c335 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -6269,9 +6269,17 @@ static void R_Bloom_MakeTexture(void) r_fb.bloomindex ^= 1; R_Mesh_SetRenderTargets(r_fb.bloomfbo[r_fb.bloomindex], NULL, r_fb.bloomtexture[r_fb.bloomindex], NULL, NULL, NULL); x *= 2; - r = bound(0, r_bloom_colorexponent.value / x, 1); - GL_BlendFunc(GL_DST_COLOR, GL_SRC_COLOR); - GL_Color(r,r,r,1); + r = bound(0, r_bloom_colorexponent.value / x, 1); // always 0.5 to 1 + if (!r_fb.bloomfbo[r_fb.bloomindex]) + { + GL_BlendFunc(GL_DST_COLOR, GL_SRC_COLOR); // square it and multiply by two + GL_Color(r,r,r,1); // apply fix factor + } + else + { + GL_BlendFunc(GL_SRC_COLOR, GL_ZERO); // square it + GL_Color(1,1,1,1); // no fix factor supported here + } R_Mesh_PrepareVertices_Generic_Arrays(4, r_screenvertex3f, NULL, r_fb.bloomtexcoord2f); R_SetupShader_Generic(intex, NULL, GL_MODULATE, 1, false, true, false); R_Mesh_Draw(0, 4, 0, 2, polygonelement3i, NULL, 0, polygonelement3s, NULL, 0); -- 2.39.2