Textures question

Started by
2 comments, last by Raduprv 21 years, 1 month ago
I was wondering, do you guys dealocate the textures once you finish using them (I mean, after some time after you used it, in case it hasn''t been used recently), or just let them sit there, hoping that they might be used later on (like, say, you stay for 5 minutes in an area of the map, but later on, when you move again, you will need those textures). My basic question is: Do you let the drivers/API do the textures caching, etc. for you, or you do it by yourself? And, if you tried both, which is faster? Height Map Editor | Eternal Lands | Fast User Directory
Advertisement
If you are using OpenGL, I know you can call this command:

glDeleteTextures(1,id);

where id is a GLuint. What this does is deletes the texture data corresponding to id. This frees up the texture name assigned to id. Once this is called the name associated with id is then glGenTextures(). If you called glDeleteTextures() and wanted to use the texture you just deleted again you would have to reload it (hope that wasn't too confusing).

As far as texture caching goes, I believe the video cards do that on their own and is fastest (not totally sure tho).

-------------------
Realm Games Company

[edited by - greatone on March 3, 2003 11:18:19 PM]
-------------------Realm Games Company
I personally do not deallocate them in-level. At level loading time, I allocate all texture that will be used in that level. When the level is unloaded, I free them. Everything related to texture management is left to the driver.

Some very special engines would benefit from manual deallocation, if they use really large textures that cannot be hold in RAM at the same time (such as eg. SGI''s clip-mapping). But typical game engines on typical consumer hardware will probably be slowed down by the process (the driver needs to reinitialize the texture cache, in order to avoid ''holes'').

I would just leave the texture management to the driver, if I was you. Nowadays, texture memory and priority management is very sophisticated, it''s much more than the old LRU scheme (some companies, such as nVidia, even classify their texture residence algorithm as trade secret). Also, the driver knows a lot more about the current memory and usage statistics than the application. So why duplicate all that work, if the driver already exposes this functionality for free ?
Thanks Yann, that''s what I did so far too, I was just wondering if, if I make my own texture cache will improve the framerate.
I mean, in some conditions (1024x768x32), and in a crowded place, some GF4 users get only 50 FPS.
And when I seen your pics, and you said that the FPS doesn''t drop bellow 40, that, of course, made me go crazy, and try to squeeze any FPS I can

Height Map Editor | Eternal Lands | Fast User Directory

This topic is closed to new replies.

Advertisement