glGenTextures question

Ok, right now in my game I have 5 textures for the terrain, possibly up to 8 for my model, and then a few random question, and I was wondering if my idea of keeping them organized would waste memory/speed. Here it is

I know that textures 6-9 an 19 would never be touched (as well as some of the 20's), but will just having them exist take memory? I was thinking you actually need to send the texture to the card to take memory, but I could be wrong.

Quote:Originally posted by Mars_999
BTW if you know that you're not going to use all 30 then why are you allocating 30 in your array?

Because I wrote a animated model class that uses meshworks data, so the textures are 1 through 8. I am already using texture 0-5, and at some point that will raise to 0-6 through 0-15 probably, so I want to keep the meshworks textures separate (start them on 20 or something)

In my 2D game engine, I just have an object that takes care of smaller parts of a large texture. In other words the object takes care of the texture.

So it has one texture variable, and each instance does a glGenTexture call once. That way, when you create a bunch of these objects the textures are taken care of nicely, without any concern of one big array with many different textures owned by different objects.

This isn't the best way for all cases I suppose, but it might work for you!