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
master
cutealien 2019-07-04 21:54:57 +00:00
parent 52e41751a8
commit 7aaf3cce9d
1 changed files with 13 additions and 11 deletions

View File

@ -122,21 +122,23 @@ public:
needSizeUpdate = true; needSizeUpdate = true;
TOpenGLTexture* currentTexture = (depthStencil && depthStencil->getDriverType() == DriverType) ? static_cast<TOpenGLTexture*>(depthStencil) : 0; TOpenGLTexture* currentTexture = (depthStencil && depthStencil->getDriverType() == DriverType) ? static_cast<TOpenGLTexture*>(depthStencil) : 0;
GLuint textureID = 0;
if (currentTexture) if (currentTexture)
{ {
if (currentTexture->getType() == ETT_2D) if (currentTexture->getType() == ETT_2D)
textureID = currentTexture->getOpenGLTextureName(); {
else GLuint textureID = currentTexture->getOpenGLTextureName();
os::Printer::log("This driver doesn't support depth/stencil to cubemaps.", ELL_WARNING);
}
const ECOLOR_FORMAT textureFormat = (textureID != 0) ? depthStencil->getColorFormat() : ECF_UNKNOWN; const ECOLOR_FORMAT textureFormat = (textureID != 0) ? depthStencil->getColorFormat() : ECF_UNKNOWN;
if (IImage::isDepthFormat(textureFormat)) if (IImage::isDepthFormat(textureFormat))
{ {
DepthStencil = depthStencil; DepthStencil = depthStencil;
DepthStencil->grab(); DepthStencil->grab();
}
}
else
{
os::Printer::log("This driver doesn't support depth/stencil to cubemaps.", ELL_WARNING);
}
} }
RequestDepthStencilUpdate = true; RequestDepthStencilUpdate = true;