1--------2--------3
| | |
| A | B |
| | |
| | |
4--------5--------6
I’m drawing a wall composed of two textures,
one goes to A, the other goes to B. My Vertex Array is: [1,4,2,5,2,5,3,6], and my Texture Array is [1,4,2,5,2,5,3,6].
My index1: [0,1,2,3]
My index2: [4,5,6,7]
I draw like this:
BINDTEXTURE1
DrawElements(Index1);
BINDTEXTURE2
DrawElements(Index2);
Here’s my question: in the vertex and texture arrays I have data copied,repeted, taking up space, is there any way I can avoid this?
No, don’t worry about it. The only way to avoid the duplication is to add more levels of indirection, which would hurt, not help, performance.
In any case, since you’re binding a new texture for each DrawElements, the cost of switching textures and rendering the geometry is probably going to overwhelm that of copying the geometry.