Annoying pause on texture first use

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.
Post Reply
Gorbstein
Posts: 37
Joined: Wed Nov 25, 2009 8:44 pm
Location: Scotland

Annoying pause on texture first use

Post by Gorbstein »

Ok, strange problem which I'm sure I've seen addressed here before, but I can't find the post.

On my game init, when I load in the object/scene data I make sure to call driver->getTexture(filename) each time I come across a required texture, to ensure that it's preloaded and stored on the video card.

However, when the game starts, the first use of any texture (ie: displaying a mesh or quad using it) produces a small but annoying halt in the game. After that, there are no slowdowns, at least until another unused texture is displayed.

It's a particular problem with my particle engine since the first time an explosion is created it's using about 5 previously undisplayed textures. It's not caused by large calls to new or delete as all my objects are pooled.

Any thoughts? Any way I can force getTexture() to actually force a texture load, besides actually displaying that texture on an invisible quad or something?

D
Image
Gorbstein
Posts: 37
Joined: Wed Nov 25, 2009 8:44 pm
Location: Scotland

Post by Gorbstein »

To confirm, actually displaying the quad on load seems to stop this pause. Weird?
Image
Adler1337
Posts: 471
Joined: Sat Aug 09, 2008 6:10 pm
Location: In your base.

Post by Adler1337 »

Screenshot/video/demo would be nice. :wink:
multum in parvo
balrajbalraj007
Posts: 16
Joined: Sun Mar 27, 2011 3:53 pm

Post by balrajbalraj007 »

Please reply to LINK: http://irrlicht.sourceforge.net/phpBB2/ ... 097#247097 Post also i am stuck with this problem.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, I already removed all the other replies from him and warned him of the upcomming ban if he won't stop immediately...
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

Also, it would be useful to know the video driver you use, and the platform you are programming.

It seems as if the texture is never flushed to the video card until it is used for the first time. On DX, this problem is solved within the system drivers, and Irrlicht only uses the standard DX code to create the textures and write the proper hw dependant surfaces.

You could, perhaps, force a texture load on the video card by drawing them to an RTT during the loading process, so it became unnoticeable. The only problem after would come if you use too much memory and that texture has to be removed from the video system, then there you would have the glitch again. It is a lame solution, i know, but it would work. And that's why patches and revisions exist after all ^^U

All in all, it could be a hardware matter, or a system drivers issue. The NVidia cards had some errors like that when they first released the DX10 compatible models, The DX9 driver code was somewhat screwed, and, for instance, Unreal Tournament 2004 became umplayable under pure hardware acceleration on some maps due to the dynamic load and unload of meshes causing exactly the same kind of glitches you are commenting. That problem was corrected in the end. That's why it could be also a problem with your system video drivers.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply