If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
z4rd0z
Posts: 11 Joined: Sat Jan 12, 2008 9:11 am
Post
by z4rd0z » Sun Feb 06, 2011 12:38 pm
Hi all,
In tutorial#9, there is a comment and some code I can't understand. I tried to search the forum but there are 11500+ posts with "always reload texture"...
Code: Select all
{
video::ITexture * texture =
Device->getVideoDriver()->getTexture( filename );
if ( texture && Model )
{
// always reload texture
Device->getVideoDriver()->removeTexture(texture);
texture = Device->getVideoDriver()->getTexture( filename );
Model->setMaterialTexture(0, texture);
}
return;
}
Can someone just tell me why once a texture is loaded we have to remove it and reload it again? Should I have to do the same in my projects?
Thanks in advance.
CuteAlien
Admin
Posts: 9734 Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:
Post
by CuteAlien » Sun Feb 06, 2011 12:47 pm
I didn't write that part, but the reason is probably that you want to make sure in a model-viewer that it loads a texture again in case it has changed in the meantime. In games you don't need that.
z4rd0z
Posts: 11 Joined: Sat Jan 12, 2008 9:11 am
Post
by z4rd0z » Sun Feb 06, 2011 1:00 pm
I see, it's just to be sure to clear the cache if the texture has been changed outside. That makes sense.
Thanks.