Skip to content

Commit 05fe475

Browse files
committed
Fix screenshots with read-only depth buffer
When the read-only depth buffer is used (if r_readonlyDepthBuffer is 2, or if it's 1 but the driver lacks certain extensions), the screenshots were done from the 3d rendering buffer instead of the final framebuffer. This caused screenshots to lack tonemapping, color grading and 2D rendering. Fix it by resetting GL_READ_FRAMEBUFFER to the default value after it is used.
1 parent 5ab62e7 commit 05fe475

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/engine/renderer/tr_backend.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2712,7 +2712,8 @@ static void RB_RenderView( bool depthPass )
27122712
int x0 = backEnd.viewParms.viewportX, x1 = x0 + backEnd.viewParms.viewportWidth;
27132713
int y0 = backEnd.viewParms.viewportY, y1 = y0 + backEnd.viewParms.viewportHeight;
27142714
GL_fboShim.glBlitFramebuffer( x0, y0, x1, y1, x0, y0, x1, y1, GL_DEPTH_BUFFER_BIT, GL_NEAREST );
2715-
R_BindFBO( currentDrawFBO );
2715+
R_BindFBO( GL_READ_FRAMEBUFFER, nullptr );
2716+
R_BindFBO( GL_DRAW_FRAMEBUFFER, currentDrawFBO );
27162717
}
27172718

27182719
if( tr.refdef.blurVec[0] != 0.0f ||

0 commit comments

Comments
 (0)