diff --git a/code/renderergl2/tr_flares.c b/code/renderergl2/tr_flares.c index c67effb7..e1d46d54 100644 --- a/code/renderergl2/tr_flares.c +++ b/code/renderergl2/tr_flares.c @@ -277,6 +277,7 @@ void RB_TestFlare( flare_t *f ) { qboolean visible; float fade; float screenZ; + FBO_t *oldFbo; backEnd.pc.c_flareTests++; @@ -284,9 +285,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] );