diff options
author | SmileTheory <SmileTheory@gmail.com> | 2013-11-20 00:45:08 -0800 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2014-06-17 17:43:36 +0100 |
commit | 5a11512c523148f43b9299bd06cb6af5c5a2ef21 (patch) | |
tree | 046c4822c5a437bcf4258e83c3c5c22910d7fd5c /src/renderergl2 | |
parent | 57ba3ccbeaebc9d573caafff8765b821ac621413 (diff) |
#6059: OpenGL2: Read depths from resolve fbo when msaa is on in RB_TestFlare().
Diffstat (limited to 'src/renderergl2')
-rw-r--r-- | src/renderergl2/tr_flares.c | 14 |
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] ); |