Author Topic: Flicking 3d landscape...what am I doing wrong?  (Read 4220 times)

Offline Darkflame

  • int
  • **
  • Posts: 55
    • View Profile
Flicking 3d landscape...what am I doing wrong?
« 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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Flicking 3d landscape...what am I doing wrong?
« Reply #1 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.

Offline Darkflame

  • int
  • **
  • Posts: 55
    • View Profile
Re: Flicking 3d landscape...what am I doing wrong?
« Reply #2 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.

Offline Darkflame

  • int
  • **
  • Posts: 55
    • View Profile
Re: Flicking 3d landscape...what am I doing wrong?
« Reply #3 on: September 05, 2010, 12:39:45 am »
This worked a charm btw. Nice and stable now.