Author Topic: frustum culling  (Read 12954 times)

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: frustum culling
« Reply #30 on: January 15, 2011, 08:06:47 pm »
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?
Code: [Select]
Object3D.getMesh().applyVertexController();
Object3D.touch();

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: frustum culling
« Reply #31 on: January 15, 2011, 08:46:55 pm »
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... :'(

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: frustum culling
« Reply #32 on: January 15, 2011, 08:53:00 pm »
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.

Offline raft

  • quad
  • ******
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: frustum culling
« Reply #33 on: January 15, 2011, 09:23:20 pm »
thanks ;D grouping applyVertexController() calls helped but not as much as i expected. anyway it feels better now