[2.1] Remove texture from data block

Problems building or running the engine, queries about how to use features etc.
Post Reply
Lax
Gnome
Posts: 364
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

[2.1] Remove texture from data block

Post by Lax » Fri Nov 02, 2018 9:07 pm

Ogre Version: :2.1:
Operating System: :Windows 7:
Render System: :DirectX:

Hi,

I have the following issue, which I'm not able to solve. I can set a texture for a data block via the following code:

Code: Select all

Ogre::HlmsTextureManager::TextureLocation texLocation = hlmsTextureManager->createOrRetrieveTexture(detail1TextureName, Ogre::HlmsTextureManager::TEXTURE_TYPE_DETAIL);
if (nullptr != texLocation.texture)
{
	this->datablock->setTexture(Ogre::TerraTextureTypes::TERRA_DETAIL1, texLocation.xIdx, texLocation.texture);
}
But how can I remove the given texture from the data block, so that the texture is no more rendered?

I tried:

Code: Select all

hlmsTextureManager->destroyTexture(detail1TextureName);
But that does not affect the data block.

Thanks in advance

Best Regards
Lax
0 x

Lax
Gnome
Posts: 364
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 8

Re: [2.1] Remove texture from data block

Post by Lax » Fri Nov 02, 2018 9:18 pm

Ok, it was easier than I thought:

Just call:

Code: Select all

if (true == detail1TextureName.empty())
{
	texLocation.texture.setNull();
}
this->datablock->setTexture(Ogre::TerraTextureTypes::TERRA_DETAIL1, texLocation.xIdx, texLocation.texture);
0 x

Post Reply