Hi!
ok, only about 7 fps of 120, but it is strange... I didnīt expect a great speed up, but not a slow down! i have reduced significantly the number of opengl state changes (texture binding, activation of texture stage, program binding, etc.). The fact is that if I do not order my objects (each one is a display list) i have 127 fps, and sorting them i have 120 fps...
my code for drawing an array of objects is like this:
Code :int matIdAnt=-1; Objeto3d *obj=0; int numObj=objetos.size(); for(int i=0; i<numObj; ++i){ obj = this->objetos[i]; if(matIdAnt!=obj->material.id){ obj->material.setupOGL_on(posCamara); matIdAnt=obj->material.id; } this->objetos[i]->dibujaGeometria(true, true); } if(obj!=0){ obj->material.setupOGL_off(); }
Note that changing this code by a simple loop does not make performance changes. The only code that slows down this line that orders objects by material id:
Code :std::sort(objetos.begin(), objetos.end(), ordenMateriales);
and of course it is only called at objects loading.
Thank you for your help.



... maybe it sorts in a way that when drawing opengl needs to do more operations?
