summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/renderergl2/tr_flares.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/renderergl2/tr_flares.c b/src/renderergl2/tr_flares.c
index 76abbdd7..4b0e792e 100644
--- a/src/renderergl2/tr_flares.c
+++ b/src/renderergl2/tr_flares.c
@@ -278,6 +278,7 @@ void RB_TestFlare( flare_t *f ) {
qboolean visible;
float fade;
float screenZ;
+ FBO_t *oldFbo;
backEnd.pc.c_flareTests++;
@@ -285,9 +286,22 @@ void RB_TestFlare( flare_t *f ) {
// don't bother with another sync
glState.finishCalled = qfalse;
+ // if we're doing multisample rendering, read from the correct FBO
+ oldFbo = glState.currentFBO;
+ if (tr.msaaResolveFbo)
+ {
+ FBO_Bind(tr.msaaResolveFbo);
+ }
+
// read back the z buffer contents
qglReadPixels( f->windowX, f->windowY, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth );
+ // if we're doing multisample rendering, switch to the old FBO
+ if (tr.msaaResolveFbo)
+ {
+ FBO_Bind(oldFbo);
+ }
+
screenZ = backEnd.viewParms.projectionMatrix[14] /
( ( 2*depth - 1 ) * backEnd.viewParms.projectionMatrix[11] - backEnd.viewParms.projectionMatrix[10] );