   How do you sort your materials?
  My materials consist of a texture (Sometimes), ambient, diffuse, specular, emissive, and shininess. Right now I have it setup so that it sets each material only once, which is good, but isn''t there an order to set them in? least amount of changes. If material1 and material2 are only differnt by a texture right now i''m setting all the other settings too.I was thinking of compiling a display list for my material when i create it then my shader can just call the list. But then that will set every property again like im doing now, but maybe it will still be faster?How are you guys doing it? 
  All you need to do is check the current state and set a new one only if it differs from the current state. Some changes are faster than others though, changing shader would be very slow, changing texture or vertex buffer is next and things like lighting materials are next. I sort my objects by a number that I supply myself.MarkFlatspace is here: The ultimate space adventurehttp://www.lostinflatspace.com