frustum culling

Started by raft, January 12, 2011, 01:32:02 AM

Previous topic - Next topic

raft

GenericVertexController.updateMesh() seems to spend a lot of cpu time. 14.1/15.9% with/without libgdx. may not be related libgdx since what i do in game while profiling (break tile/time ratio) also determines this.

a question: does it matter calling code below many times in a frame or should i call it once?
Object3D.getMesh().applyVertexController();
Object3D.touch();


EgonOlsen

touch() is cheap, but apply() can be costly. Internally, it calls your controller's apply method and copies the SimpleVector states again back into the mesh in updateMesh(). It also updates the bounding box. It should help to group your operations and apply them all in one call. Or you can simply call your apply-method directly several times if that is needed and make one final call to updateMesh() yourself omitting the call to Mesh.applyVertexController() completely. That might be the way that causes the least changes in your code.

I'm a bit disappointed that libgdx doesn't do any good in this case...i'll leave support for it in anyway, but i expected more from it... :'(

EgonOlsen

BTW: I've updated the jar in the test-directory with one that adds the timing output to the libgdx path. It also fixes a flaw of the non-libgdx path that shouldn't had any influence in your case though.

raft

thanks ;D grouping applyVertexController() calls helped but not as much as i expected. anyway it feels better now