www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Darkflame on August 30, 2010, 10:47:44 pm

Title: Flicking 3d landscape...what am I doing wrong?
Post by: Darkflame on August 30, 2010, 10:47:44 pm
While working on my AR application I noticed the landscape often "flicked" at first I thought this was a sensor issue, but dismissed that after I found the problem is still there even with a completely static set of co-ordinates.
Heres a video of the problem;

http://www.youtube.com/watch?v=dphRVM4HXaM

Essentially every time the sensors update now, this code runs;

Code: [Select]
Camera worldcam = world.getCamera();

worldcam.getBack().setIdentity();

float Z = xyzAngles.z;
float Y = xyzAngles.y;
float X = xyzAngles.x;

//worldcam.rotateCameraAxis(new SimpleVector(0,1,0), -Z);
//worldcam.rotateCameraAxis(new SimpleVector(1,0,0), X);
//worldcam.rotateCameraAxis(new SimpleVector(0,0,1), -Y);

worldcam.rotateCameraAxis(new SimpleVector(0,1,0), -0.081920266f);
worldcam.rotateCameraAxis(new SimpleVector(1,0,0), 0.5303804f);
worldcam.rotateCameraAxis(new SimpleVector(0,0,1), 0.84379244f);


Any idea's what cause's the graphical glitch?
Title: Re: Flicking 3d landscape...what am I doing wrong?
Post by: EgonOlsen on August 30, 2010, 11:56:46 pm
Most likely a threading issue. Rendering and manipulation of the camera are most likely taking place in different threads, which isn't a good idea. Either synchronize this part with the rendering or (and better) just let the sensor update set some flags and do the actual operations based on this flags in the rendering thread.
Title: Re: Flicking 3d landscape...what am I doing wrong?
Post by: Darkflame on August 31, 2010, 12:59:34 pm
ok, I'll try putting all my camera manipulations into "public void onDrawFrame(GL10 gl) {..." and see if that helps.
Title: Re: Flicking 3d landscape...what am I doing wrong?
Post by: Darkflame on September 05, 2010, 12:39:45 am
This worked a charm btw. Nice and stable now.