From 259030de47daa3475ef939b3e9dd5b3d4b7f3fc5 Mon Sep 17 00:00:00 2001 From: LuisAntonRebollo Date: Sat, 8 Nov 2014 09:43:29 +0100 Subject: [PATCH] Fix imposter capture on OpenGL. --- Engine/source/util/imposterCapture.cpp | 3 ++- Engine/source/util/imposterCapture.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Engine/source/util/imposterCapture.cpp b/Engine/source/util/imposterCapture.cpp index a8fff13e8..a34182232 100644 --- a/Engine/source/util/imposterCapture.cpp +++ b/Engine/source/util/imposterCapture.cpp @@ -229,7 +229,7 @@ void ImposterCapture::_renderToTexture( GFXTexHandle texHandle, GBitmap *outBitm PROFILE_SCOPE( ImposterCapture_RenderToTexture ); mRenderTarget->attachTexture( GFXTextureTarget::Color0, texHandle ); - mRenderTarget->attachTexture( GFXTextureTarget::DepthStencil, GFXTextureTarget::sDefaultDepthStencil ); + mRenderTarget->attachTexture( GFXTextureTarget::DepthStencil, mDepthBuffer ); GFX->setActiveRenderTarget( mRenderTarget ); GFX->clear( GFXClearZBuffer | GFXClearStencil | GFXClearTarget, color, 1.0f, 0 ); @@ -373,6 +373,7 @@ void ImposterCapture::begin( TSShapeInstance *shapeInst, mBlackTex.set( mDim, mDim, GFXFormatR8G8B8A8, &GFXDefaultRenderTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) ); mWhiteTex.set( mDim, mDim, GFXFormatR8G8B8A8, &GFXDefaultRenderTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) ); mNormalTex.set( mDim, mDim, GFXFormatR8G8B8A8, &GFXDefaultRenderTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) ); + mDepthBuffer.set( mDim, mDim, GFXFormatD24S8, &GFXDefaultZTargetProfile, avar( "%s() - (line %d)", __FUNCTION__, __LINE__ ) ); // copy the black render target data into a bitmap mBlackBmp = new GBitmap; diff --git a/Engine/source/util/imposterCapture.h b/Engine/source/util/imposterCapture.h index b18c3f1da..286e38ab6 100644 --- a/Engine/source/util/imposterCapture.h +++ b/Engine/source/util/imposterCapture.h @@ -70,6 +70,7 @@ protected: GFXTexHandle mBlackTex; GFXTexHandle mWhiteTex; GFXTexHandle mNormalTex; + GFXTexHandle mDepthBuffer; SceneRenderState *mState; TSShapeInstance *mShapeInstance;