Im making a tile based game, where i have a grid of tiles (50 x 50), each with a different texture. The texture for each tile is not allways the same (it changes).
I am drawing it like this:
loop x from 1 to 50
loop y from 1 to 50
Bind texture
Draw quad
Is this the best/fastest way to do this?
I dont think that i can use a displaylist because the textures change (?)
You would be much faster packing the tiles into fewer textures and using texture coordinates to select the tile. The tiles can still change but you eliminate a lot of the texture binds.
Combining textures wont really work… I have (potentially) 100’s of textures. Pre-combining these, in all cobinations would just generate even more different textures. Combining them run-time sort of defies the purpose (optimizing).
Originally posted by delphiripper:
[b]Combining textures wont really work… I have (potentially) 100’s of textures. Pre-combining these, in all cobinations would just generate even more different textures. Combining them run-time sort of defies the purpose (optimizing).
But thanks, it could have worked [/b]
I don’t think dorbie was recommending you cache all possible combinations. You could keep everything the way you have it now, except store each tile in a bigger texture. Then, when you need to use a tile, you bind the big texture it’s stored in, and adjust the texture matrix so that [0,1] is mapped to the portion of the big texture that holds the tile you want. Voila - fewer textures!
There’s really nothing you can do with individual textures that you can’t do with this method, except borders and wrapping coords.