From 91e096195831e1263ded1aa0e71808d6918d8dc0 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 15 Aug 2006 00:39:41 +0000 Subject: [PATCH] fix depth buffer cleared when it shouldn't be --- stepmania/src/RageDisplay_OGL.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 0953bb7f10..3b4771bc1c 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -2082,8 +2082,16 @@ void RageDisplay_OGL::SetRenderTarget( unsigned iTexture, bool bPreserveTexture * consistency. */ glClearColor( 0,0,0,0 ); SetZWrite( true ); + + /* If bPreserveTexture is false, clear the render target. Only clear the depth + * buffer if the target has one; otherwise we're clearing the real depth buffer. */ if( !bPreserveTexture ) - glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + { + int iBit = GL_COLOR_BUFFER_BIT; + if( pTarget->GetParam().bWithDepthBuffer ) + iBit |= GL_DEPTH_BUFFER_BIT; + glClear( iBit ); + } } void RageDisplay_OGL::SetPolygonMode( PolygonMode pm )