single or multiple vertex arrays per mesh?

If I am drawing a model with multiple materials is it better to store all verts in a single vertex array and just use portions of it or use one array per material?

Drawing all the elements from multiple arrays seems simplest, but will there be a performance win if all I have to do is enable a “giant” array and then only switch the texture (and any other material properties) as I draw the model?

A single giant array minimizes state changes, so it’s faster. Moreover with a single array you can “compile” it whereas compiled vertex arrays are not compatible with multiple arrays (well, maybe OpenGL1.4 added that feature).

Though, if your mesh is really big there could be memory issues for vertex array range and-the-like.

when using different geometry for different materials you can sort your scene-wide geometry by material easily to minimize texture/material/vp/fp state changes.
when doing this, you have to set up the geometry arrays before each DrawElements call because you will render geometry chunks from different objects with same material.

so you have to decide what is faster -> minimizing state changes for your material or minimizing clientarray setups (and modelview matrix loading).

i think the first solution is faster. to minimize clientarray setups also, you could put all vertices and face-indicies in many global material dependend pools or even one pool.

but like everywhere: it depends…

regards,
jan