The Subject already says it.
I want to use a single VBO to render many cubes (already works). But I want to use many different Textures for each cube! I think the only chance I have is to bind all Textures and send an index through the VBO. And then the shader has to select the right texture (depending on the index). The problem: I’m using much more than 32 Textures (max. active textures). So I have already thought of some solutions:
[ul][li]Texture Array. Problem: My target system doesn’t support them!Texture3D. Problem: I think the Texture Layers are filtered linear! Anyway the 3D-texture mixes up with my MipMap-LevelsI just bind one big Texture that contains all of my textures and select them with texture coordinates. Problem: If The Texture is rendered bigger than its real size or smaller than 1 pixel, it produces graphic errors, because I use MipMaps and linear filtering.[/ul][/li]I’m glad about any suggestion
Those pretty much are your options. Even high-end DX11 hardware doesn’t have more than 16 texture units per shader stage (there are 32 enumerators, but the number of enumerators does not limit the number of textures). So you’re not going to get this done by binding a bunch of individual texture objects.
A texture atlas is the only option that will allow you to do what you want on such hardware. Just don’t fill in the entire mipmap chain. Also, try putting some empty space between the textures.
As a side note to the topic poster, that will imply to use 3D texture coordinates.
Texture atlases are certainly the most interresting things to do here. But I wonder if the “usual” way to do thing, ie, split the single rendering call to many, one for each texture and bind textures, won’t be simpler and as fast since it will simplify texture unit management and shaders.
But I wonder if the “usual” way to do thing, ie, split the single rendering call to many, one for each texture and bind textures, won’t be simpler and as fast since it will simplify texture unit management and shaders.
He’s drawing “many cubes”: I read that as code-language for “Minecraft-clone”. So that probably won’t work.