Hi!
I guess this is a pretty basic question:
Which is the optimal way of storing vertex data (flexibility, performance)? That is vertex positions, texture coords, normals.
I have implemented 3 global arrays (pos, norm, tex) with the data and each mesh has a bunch of indices representing the arrays. I can then call:
glVertexPointer
glNormalPointergl
TexCoordPointer
once when all my models has been loaded
when i want to render i simply enable the arrays i want for a specific mesh, enable textures, ligthing (whaterver) and call
glDrawElements with the indices for my mesh.
This is all simple enough but maybesomewhat wastefull since the arrays must be aligned according to the indices. The other problem i’m now facing is how to handle multiple textures.
I have a simple shader script technology implemented which can render in multiple passes, but only with the same texture coordinates (since i only have one array). It does not seem right to add more global arrays. Does anyone have a better idea on how to store vertex data (per mesh maybe, but will this make a performance hit)? I’m also wondering if it will happen in reality that a mesh needs more than one set of texture coordinates?
regards!