VBO/VAO + Triangle-Specific Textures?


I am rewriting a program right now to use VBOs instead of glBegin/glEnd. Before, I used uniforms for my textures, but now I can not define uniforms for specific triangles but only for the whole render. Attriutes also do not work, because I would have to pass the sampler2D’s to the Fragment Shader using varyings and that does not work.
So how should I do it?

Have a large texture containing all the textures used by the triangles in the buffer, and use appropriate coordinates.

Do you really think this is a good solution? My textures are pretty big.

I’ve got a better idea: Make an array with all the textures and submit the index as an int. Or is there a better solution?

Damn. I did not remember that I can only bind a certain number of textures.
So come on there must be a better way than Zyx_2000’s

Zyx_2000’s solution is the most common one, however, if you target GL3+ cards, you can take advantage of texture arrays.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.