summaryrefslogtreecommitdiffstats
path: root/src/demos/applets/GearsApplet.java
blob: 73bef9614ef07700be55cdaa863a6976406fc67a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package demos.applets;

import java.applet.*;
import java.awt.*;
import demos.gears.Gears;
import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
import com.jogamp.opengl.util.FPSAnimator;
import javax.media.opengl.GLAnimatorControl;

/** Shows how to deploy an applet using JOGL. This demo must be
    referenced from a web page via an <applet> tag. */

public class GearsApplet extends Applet {
  private GLAnimatorControl animator;

  public void init() {
    GLProfile.initSingleton(false);
    setLayout(new BorderLayout());
    GLCanvas canvas = new GLCanvas();
    canvas.addGLEventListener(new Gears());
    canvas.setSize(getSize());
    add(canvas, BorderLayout.CENTER);
    animator = new FPSAnimator(canvas, 60);
  }

  public void start() {
    animator.start();
  }

  public void stop() {
    // FIXME: do I need to do anything else here?
    animator.stop();
  }
}