PDA

View Full Version : Texture changes?



dabeav
06-28-2002, 04:38 AM
How fast is it to change textures mid stride? I want to create a map based on zones. Each zone containing its own indexed vertex array, and its own texture. I would load all the textures before the programs visual execution. Then I would simply tell OpenGL to use only the textures that are visable, that way I have more room in memory for other textures, say creatures or such. Or would it be smarter to simply create ONE large texture to encompass all the zones, and dont bother jocking them for space??

mikael_aronsson
06-28-2002, 04:42 AM
Hi !

Swithing textures does take some time, so you can expect a little better performance with only one texture, but of course this only works if it's not to big.

Sending the textures down the pipeline to the videocard on the other hand is very slow but many times you hide this when you switch a level in a game or something like that, but keeping as few textures as possible is always giving better performance.

Mikael

Misfit
06-28-2002, 11:41 AM
Hi,

You could ofcourse use glPrioritizeTextures() to create your own "visible working set",
but most OpenGL implementations use a LRU strategy to decide which objects should be moved out of the working set. (so I have been told)

Cheers,

Jan van Nunen

BlackJack
06-28-2002, 03:06 PM
In NO CASE use just one texture for the whole map, it will kill your performance straightly if the texture is really big (like 1024x1024 or more). It's heavily depending on the GPU you're using, how much a textureswitch and the texture size costs, but there are limits you shouldn't exceed. I think 512x512 is in general the limit of the humour on the GeForce 3. But that's always depending on how you flush your vertices. But for the case that you are only using the first 10% on the X-axis of a big texture all the time... it would damage your performance heavily, because it does not only count, how many texels you're using of the texture, but also which memory is used all in all. (caching and so on)

I'm using at the moment also one texture for each cell and my FPS tells me it was the right decision http://www.opengl.org/discussion_boards/ubb/wink.gif. Where by for models for example it's more senseful to use one 1024x1024 texture instead of 4 smaller ones, because of the amount of API calls you can save and because anyway the whole texture is used within one single flush. But if you anyway have to do a call for each of your cells I would in any case propose the one small texture for each.

BlackJack