From 7aaf3cce9d705b44f32ddd95236e3a3c2bf090b1 Mon Sep 17 00:00:00 2001 From: cutealien Date: Thu, 4 Jul 2019 21:54:57 +0000 Subject: [PATCH] Refactor COpenGLCoreRenderTarget::setTexture slightly. Just making it easier to see when DepthStencil can be set (we never have a depth texture format when we have no texture). git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5833 dfc29bdd-3216-0410-991c-e03cc46cb475 --- source/Irrlicht/COpenGLCoreRenderTarget.h | 24 ++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/source/Irrlicht/COpenGLCoreRenderTarget.h b/source/Irrlicht/COpenGLCoreRenderTarget.h index def4ffa9..1839be9b 100644 --- a/source/Irrlicht/COpenGLCoreRenderTarget.h +++ b/source/Irrlicht/COpenGLCoreRenderTarget.h @@ -122,21 +122,23 @@ public: needSizeUpdate = true; TOpenGLTexture* currentTexture = (depthStencil && depthStencil->getDriverType() == DriverType) ? static_cast(depthStencil) : 0; - GLuint textureID = 0; - if (currentTexture) { if (currentTexture->getType() == ETT_2D) - textureID = currentTexture->getOpenGLTextureName(); - else - os::Printer::log("This driver doesn't support depth/stencil to cubemaps.", ELL_WARNING); - } + { + GLuint textureID = currentTexture->getOpenGLTextureName(); - const ECOLOR_FORMAT textureFormat = (textureID != 0) ? depthStencil->getColorFormat() : ECF_UNKNOWN; - if (IImage::isDepthFormat(textureFormat)) - { - DepthStencil = depthStencil; - DepthStencil->grab(); + const ECOLOR_FORMAT textureFormat = (textureID != 0) ? depthStencil->getColorFormat() : ECF_UNKNOWN; + if (IImage::isDepthFormat(textureFormat)) + { + DepthStencil = depthStencil; + DepthStencil->grab(); + } + } + else + { + os::Printer::log("This driver doesn't support depth/stencil to cubemaps.", ELL_WARNING); + } } RequestDepthStencilUpdate = true;