How do I handle lots of textures

Started by
11 comments, last by hatfarm 11 years ago

Does that mean it would be better for me to do something like Vlad86 is saying and just have a spritesheet of textures? They're all 32x32, so that wouldn't be hard per se, I'd just rather not have to do that if I don't have to....

Second, what would be the best way to draw that many tiles? Currently, I'm drawing 4 tiles with an ibo and using glDrawElements with a buffer offset into my index buffer....

There is a connection between those two. Generally one would want to draw as many tiles as possible with a single draw call. This is actually a good use case for instancing. This also means you pretty much have to do the spritesheet thing (which is preferable for performance anyway).

You can only have 48 textures bound AT ONCE...

Uh, you can query how many texture units there are from GL_MAX_TEXTURE_IMAGE units. The spec says it has to be at least 16 but it will vary between vendor/driver/card. On my laptop with AMD gpu it is for example 32. So you can't just state 48 as hard number.

Advertisement

zacaj, on 03 Apr 2013 - 20:42, said:
You can only have 48 textures bound AT ONCE...
Uh, you can query how many texture units there are from GL_MAX_TEXTURE_IMAGE units. The spec says it has to be at least 16 but it will vary between vendor/driver/card. On my laptop with AMD gpu it is for example 32. So you can't just state 48 as hard number.

Ah. I was remembering GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS. The 3.3 spec requires the card support 16 textures for each stage.

I think the 48 number came from my original post, because one of the tutorials I was reading said you could count on at least 48 these days. I used that number in my original post.

Another question, instancing was mentioned. What do you mean by instancing? I'm always interested in hearing about an increasing performance.

This topic is closed to new replies.

Advertisement