Author Topic: renderScene() not applying changes to objects  (Read 3259 times)

Offline keaukraine

  • byte
  • *
  • Posts: 34
    • View Profile
renderScene() not applying changes to objects
« on: November 25, 2010, 08:32:53 pm »
After opening another instance of activity previously launched activity makes some re-initialization stuff after which renderScene() call seems to be ignoring rotation made to objects.
Camera rotates as usual, but transformations are not applied to objects, they keep their old transformations applied.

In short, it behaves like renderScene() doesn't do any work.
Calling world.buildAllObjects() before renderScene() doesn't work as well.
Please explain what needed stuff can be lost after re-initialization or may be if it's a bug in JPCT-AE, fix it.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: renderScene() not applying changes to objects
« Reply #1 on: November 25, 2010, 09:44:41 pm »
No idea what you are doing in the re-init step, but IMHO the only way in which this might happen is, if you don't translate the right object instances. Maybe you are recreating them without assigning them to the world, so that the objects you are rendering are no longer the objects that you transform? If renderScene() wouldn't work, you won't see anything at all.
« Last Edit: November 25, 2010, 09:48:33 pm by EgonOlsen »

Offline keaukraine

  • byte
  • *
  • Posts: 34
    • View Profile
Re: renderScene() not applying changes to objects
« Reply #2 on: November 25, 2010, 10:54:00 pm »
Thanks for giving me explanations and hints, now it works fine.

To fix the problem I'm calling world.removeAllObjects() and then world.addObject() 10 times on every frame redraw. I hope adding objects to world isn't very expensive thing, I suppose it should only set up references to them in some array. At least I didn't notice any performance drop if I perform adding 10 objects to world every frame.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: renderScene() not applying changes to objects
« Reply #3 on: November 25, 2010, 11:13:58 pm »
Adding isn't very expensive, but it doesn't sound right to me to do this every frame. There has to be a better solution than this...