#6059: OpenGL2: Read depths from resolve fbo when msaa is on in RB_TestFlare().

This commit is contained in:
SmileTheory 2013-11-20 00:45:08 -08:00
parent dadd808da5
commit e686010d73
1 changed files with 14 additions and 0 deletions

View File

@ -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] );