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

Started by
-1 comments, last by CyberSlag5k 19 years, 1 month ago
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?
Without order nothing can exist - without chaos nothing can evolve.

This topic is closed to new replies.

Advertisement