protected void startGLCanvas() {
    if (frameRate > 0) {
      animator = new FPSAnimator(canvas, frameRate);
    } else {
      animator = new Animator();
      animator.add(canvas);
      ((Animator) animator).setRunAsFastAsPossible(true);
    }

    animator.start();
    wasAnimating = true;
  }
예제 #2
0
 /**
  * Set the frames per second the display should be shown with.
  *
  * @param fps the target frames per second
  */
 @Override
 public void setFPS(final int fps) {
   manager.renderStarted();
   if (animator != null) {
     animator.stop();
     animator.remove(this);
     animator = null;
   }
   if (fps > -1) {
     setIgnoreRepaint(true);
     // animator = new Animator(this);
     animator = new FPSAnimator(this, fps, true);
     animator.start();
   } else {
     setIgnoreRepaint(false);
   }
 }
예제 #3
0
 /**
  * Dispose function called when the rendering of this canvas stopped. It can be used to free some
  * resources.
  *
  * @param drawable the drawable object used to free some resources
  */
 @Override
 public void dispose(final GLAutoDrawable drawable) {
   if (animator != null) {
     animator.stop();
     animator = null;
   }
   TextureJOGL.dispose();
   AbstractTextureAtlas.dispose();
 }