Hello java-gaming board!
I’m having problems with using FPSAnimator on a GLCanvas. The problem is, it seems to be updated twice.
For example if I set the FPS to 2 like this:
Canvas canvas = new Canvas(this,glCaps);
this.add(canvas);
FPSAnimator animator = new FPSAnimator(canvas, 2);
animator.add(canvas);
animator.start();
and in the GLCanvas’ display method I write this:
timeDiff = time-tick;
tick = time;
time= System.currentTimeMillis();
System.out.println(timeDiff);
the output alternates between the expected (~500) and 2-4 !! ms. Why is it called twice? I even tried setIgnoreRepaint(true); on the canvas, doesn’t help.
Also gl.setSwapInterval(1); does not seem to have any effect on this.
What could be causing this?
Any help would be appreciated! Thanks!