# Using glDrawRangeElements by sorting, not splittiing, models of differing materials

This topic is 4736 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I had originally planned on splitting up my models into groups based on the materials of their surfaces (or can materials be split up by vertex?). However, I'm thinking perhaps I don't have to. I'll just sort the polygons by materials and then keep an array of structures (or hell even a class) that holds the position of the material change in the index list and the material properties themselves. So I could do something like this:
for(int i = 0; i < matList.getSize(); i++)
{
matList.setMaterials();
glDrawRangeElements(GL_TRIANGLES, matList.getStartPos(), matList.getEndPos(), numPolygons, indexList);
}


Does that look good? Or is making multiple calls to glDrawRangeELements going to kill the efficiency I recieve from it?