Author Topic: transformVertices null pointer  (Read 1499 times)

Offline dectar

  • byte
  • *
  • Posts: 21
    • View Profile
transformVertices null pointer
« on: March 13, 2011, 02:41:37 am »
Hi, I'm currently getting a seemingly random intermittent null pointer exception at com.threed.jpct.Object3D.transformVertices(Object3D.java:6254) when Im attempting to render a scene. I can do the same thing a few times and this occurs sometimes but not most of the time. Have you any idea what the cause of this is or why the error seems to be random?

Thanks

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11775
    • View Profile
    • http://www.jpct.net
Re: transformVertices null pointer
« Reply #1 on: March 13, 2011, 09:34:33 am »
As stated a dozen times, jPCT is NOT thread safe. You are most likely fiddling around with objects or the world in another thread than the rendering thread (like in some listener method). Don't do this. Make sure that manipulation of jPCT related objects happen in the same thread as the rendering or synchronize both.
« Last Edit: March 13, 2011, 09:37:03 am by EgonOlsen »

Offline dectar

  • byte
  • *
  • Posts: 21
    • View Profile
Re: transformVertices null pointer
« Reply #2 on: March 14, 2011, 10:37:41 am »
ah, yes I have been making small changes to the world in the actual android UI thread so this must be the issue as you stated. I will fix later. thanks for your help.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11775
    • View Profile
    • http://www.jpct.net
Re: transformVertices null pointer
« Reply #3 on: March 14, 2011, 08:22:17 pm »
I'll add some code to give a warning in such cases as it's a common mistake.

Offline dectar

  • byte
  • *
  • Posts: 21
    • View Profile
Re: transformVertices null pointer
« Reply #4 on: March 25, 2011, 01:26:50 pm »
sorry for not getting back on this sooner, have been pretty busy. I stopped making any changes to my world from the UI thread and now all works perfectly. Thanks again. I will add my game to project page sometime in next week or so.