jPCT-AE - a 3d engine for Android > Support

Terrain and GenericVertexController..

<< < (5/5)

LowPolyMan:

--- Quote from: EgonOlsen on April 05, 2013, 10:33:34 am ---You are not supposed to access jPCT-AE related instances from inside your event handler methods. jPCT isn't thread safe and the render thread is different from the thread that handles the events. Mixing access from both can lead to nullpointer exceptions and other kind of errors.
Just let the handler methods set some flags and evaluate them in the render method: http://www.jpct.net/wiki/index.php/Hello_World_for_Android#onTouchEvent.28MotionEvent_me.29

--- End quote ---

Ok, my misunderstanding of java i quess, i thought calling a function in render thread  from event handler was thread safe. Now i add a boolean and 2 ints in render thread so i set repeaint to true and set repaintx and repainty, from  onDrawFrame i check it and call the function repeaintUV.
Up until now i got no more nullpointer. I updated the source.

In my own app, i use a bigger terrain and i use a GenericVertexController. When i try to change for example coord 50,50 it changes a total different coord. I end up storing all polyid's in a array and look them up that way to get it working. I think i made some programming mistake, but you mabe know something about this?


[attachment deleted by admin]

Navigation

[0] Message Index

[*] Previous page

Go to full version