]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix r_bloom_colorexponent with fbo (fixed version doesn't support npot exponents...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 25 Nov 2011 13:13:02 +0000 (13:13 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 25 Nov 2011 13:13:02 +0000 (13:13 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11570 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 28b8efe8cf2415d937307694e9014a18bf3c73e3..fa02c335663adc98c11a62a86d23121fcbc8f1c6 100644 (file)
@@ -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);