Page 1 of 1
reloading model textures
Posted: Wed Nov 27, 2019 6:14 am
by netpipe
in my main loop i have
Code: Select all
if (counter > 500){
myobject= smgr->addAnimatedMeshSceneNode(smgr->getMesh("./xcube/mdl/Cube.irrmesh"));
myobject->setScale(core::vector3df(135,135,135));
counter = 0;
} else {
counter++;
}
but the textures arnt updated after being changed was wondering how i should do this. does it need to be dropped first ?
Re: reloading model textures
Posted: Wed Nov 27, 2019 2:40 pm
by CuteAlien
Yeah, the problem is that textures are still in the texture-cache. Unfortuntly we don't have a way yet to "force" texture-reloading. So you have to find out which textures are used and clear those from cache first with IVideoDriver::removeTexture (and be careful you can't just delete the full texture-cache or the default-font is gone... and that one is used in the UI).
Re: reloading model textures
Posted: Wed Nov 27, 2019 5:49 pm
by netpipe
worked like a charm for the textured cube i may put this with the rollovericons for some kinda image browser, possibly arcball rotation for it
Code: Select all
if (counter > 500){
ITexture *textmp = driver->getTexture( "./tex/picture4.jpg" );
driver->removeTexture( textmp );
driver->getTexture( "./tex/picture4.jpg" );
counter = 0;
} else {
counter++;
}
Re: reloading model textures
Posted: Sat Nov 20, 2021 4:33 am
by netpipe
after trying again it did not work but caused crash this time. will investigate more soon.
Re: reloading model textures
Posted: Sat Nov 20, 2021 2:01 pm
by CuteAlien
In theory OK, but you can optimize it by using findTexture (which searchs only cache) instead of getTexture. Otherwise on first time you load the texture twice. Crash maybe because you still use the old texture somewhere?
Re: reloading model textures
Posted: Tue Nov 23, 2021 6:12 pm
by netpipe
there is an autoTexReload example for irrlicht too that does not seem to work anymore either. maybe something happened to the texture cache system.
Re: reloading model textures
Posted: Wed Nov 24, 2021 10:42 am
by CuteAlien
Which example do you mean?
edit: OK, seeing your second post, guess you mean that :-)
edit2: Thought that one is using a bit different mechanism as it tries to keep the texture-pointer intact.
Re: reloading model textures
Posted: Sat Nov 27, 2021 4:29 am
by netpipe
Re: reloading model textures
Posted: Sat Nov 27, 2021 4:46 am
by netpipe
viewtopic.php?f=9&t=43269&p=306263 solved here. only works with png not jpg