com.jogamp.opengl.util.FPSAnimator Java Examples

The following examples show how to use com.jogamp.opengl.util.FPSAnimator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JCuboid.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) {

        final GLProfile gp = GLProfile.get(GLProfile.GL2);
        GLCapabilities cap = new GLCapabilities(gp);

        final GLCanvas gc = new GLCanvas(cap);
        JCuboid cuboid = new JCuboid();

        gc.addGLEventListener(cuboid);
        gc.setSize(100, 100);

        final JFrame frame = new JFrame(" JOGL Cuboid");
        frame.add(gc);
        frame.setSize(500, 400);
        frame.setVisible(true);
        final FPSAnimator animator = new FPSAnimator(gc, 300, true);

        animator.start();
    }
 
Example #2
Source File: JRotation.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) {

        final GLProfile gp = GLProfile.get(GLProfile.GL2);
        GLCapabilities cap = new GLCapabilities(gp);

        final GLCanvas gc = new GLCanvas(cap);
        JRotation jr = new JRotation();
        gc.addGLEventListener(jr);
        gc.setSize(400, 400);

        final JFrame frame = new JFrame("JOGL Rotation");

        frame.add(gc);
        frame.setSize(500, 400);
        frame.setVisible(true);

        final FPSAnimator animator = new FPSAnimator(gc, 400, true);
        animator.start();

    }
 
Example #3
Source File: J3DCube.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) {

        final GLProfile gp = GLProfile.get(GLProfile.GL2);
        GLCapabilities cap = new GLCapabilities(gp);

        final GLJPanel gc = new GLJPanel(cap);
        J3DCube cube = new J3DCube();

        gc.addGLEventListener(cube);
        gc.setSize(400, 400);

        final JFrame frame = new JFrame(" 3D cube");
        frame.add(gc);
        frame.setSize(600, 500);
        frame.setVisible(true);

        final FPSAnimator animator = new FPSAnimator(gc, 200, true);
        animator.start();
    }
 
Example #4
Source File: JPaddle.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) {

        final GLProfile gp = GLProfile.get(GLProfile.GL2);
        GLCapabilities cap = new GLCapabilities(gp);

        final GLCanvas gc = new GLCanvas(cap);
        JPaddle paddle = new JPaddle();

        gc.addGLEventListener(paddle);
        gc.setSize(400, 400);

        final JFrame frame = new JFrame("Motor Paddle");
        frame.add(gc);
        frame.setSize(600, 500);
        frame.setVisible(true);

        final FPSAnimator animator = new FPSAnimator(gc, 200, true);
        animator.start();
    }
 
Example #5
Source File: JLight.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) {

        final GLProfile gp = GLProfile.get(GLProfile.GL2);
        GLCapabilities cap = new GLCapabilities(gp);

        final GLCanvas gc = new GLCanvas(cap);
        JLight tr = new JLight();
        gc.addGLEventListener(tr);
        gc.setSize(400, 400);

        final JFrame frame = new JFrame("JOGL Lighting");
        frame.add(gc);
        frame.setSize(500, 400);
        frame.setVisible(true);

        final FPSAnimator animator = new FPSAnimator(gc, 400, true);
        animator.start();
    }
 
Example #6
Source File: J3DTriangle.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) {

        final GLProfile gp = GLProfile.get(GLProfile.GL2);
        GLCapabilities cap = new GLCapabilities(gp);

        final GLCanvas gc = new GLCanvas(cap);
        J3DTriangle triangle = new J3DTriangle();

        gc.addGLEventListener(triangle);
        gc.setSize(400, 400);

        final JFrame frame = new JFrame("3D Triangle");

        frame.add(gc);
        frame.setSize(500, 400);
        frame.setVisible(true);

        final FPSAnimator animator = new FPSAnimator(gc, 400, true);
        animator.start();
    }
 
Example #7
Source File: CubeSample2.java    From MeteoInfo with GNU Lesser General Public License v3.0 6 votes vote down vote up
public CubeSample2() {
	GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2));
	glu = new GLU();

	glWindow = GLWindow.create(caps);
	glWindow.setTitle("Cube demo (Newt)");
	glWindow.setSize(300, 300);
	glWindow.addGLEventListener(this);

	glWindow.addWindowListener(new WindowAdapter() {
		@Override
		public void windowDestroyed(WindowEvent arg0) {
			System.exit(0);
		}
	});
	glWindow.addMouseListener(this);
	glWindow.addKeyListener(this);
	//animator = new FPSAnimator(30);
	animator = new FPSAnimator(glWindow, 30, false);
	animator.add(glWindow);
	animator.start();
	animator.pause();
	glWindow.setVisible(true);
}
 
Example #8
Source File: Fireworks.java    From MeteoInfo with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) {
    // Create the OpenGL rendering canvas
    final GLProfile gp = GLProfile.get(GLProfile.GL2);
    GLCapabilities cap = new GLCapabilities(gp);

    final GLCanvas canvas = new GLCanvas(cap);
    Fireworks renderer = new Fireworks();
    canvas.addGLEventListener(renderer);

    canvas.addKeyListener(renderer);
    canvas.setFocusable(true);  // To receive key event
    canvas.requestFocus();

    // Create a animator that drives canvas' display() at the specified FPS.
    final FPSAnimator animator = new FPSAnimator(canvas, FPS, true);

    // Create the top-level container frame
    final JFrame frame = new JFrame(); // Swing's JFrame or AWT's Frame
    frame.getContentPane().add(canvas);
    frame.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            // Use a dedicate thread to run the stop() to ensure that the
            // animator stops before program exits.
            new Thread() {
                @Override
                public void run() {
                    animator.stop(); // stop the animator loop
                    System.exit(0);
                }
            }.start();
        }
    });
    frame.setTitle(TITLE);
    frame.pack();
    frame.setSize(640, 480);
    frame.setVisible(true);
    animator.start(); // start the animation loop
}
 
Example #9
Source File: CubeTexture.java    From MeteoInfo with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) {
    final GLProfile profile = GLProfile.get(GLProfile.GL2);
    GLCapabilities capabilities = new GLCapabilities(profile);
    // The canvas 
    final GLJPanel glcanvas = new GLJPanel(capabilities);
    CubeTexture r = new CubeTexture();
    glcanvas.addGLEventListener(r);
    glcanvas.setSize(400, 400);
    final JFrame frame = new JFrame(" Textured Cube");
    frame.getContentPane().add(glcanvas);
    frame.setSize(600, 600);
    frame.setVisible(true);
    final FPSAnimator animator = new FPSAnimator(glcanvas, 300, true);
    animator.start();
}
 
Example #10
Source File: DelaunayTriangulationExample.java    From delaunay-triangulator with MIT License 5 votes vote down vote up
public static void main(String[] args) {
    Frame frame = new Frame("Delaunay Triangulation Example");
    frame.setResizable(false);

    GLCapabilities caps = new GLCapabilities(GLProfile.get("GL2"));
    caps.setSampleBuffers(true);
    caps.setNumSamples(8);

    GLCanvas canvas = new GLCanvas(caps);

    DelaunayTriangulationExample ex = new DelaunayTriangulationExample();
    MouseListener lister = ex;
    canvas.addGLEventListener(ex);
    canvas.setPreferredSize(DIMENSION);
    canvas.addMouseListener(lister);

    frame.add(canvas);

    final FPSAnimator animator = new FPSAnimator(canvas, 25);

    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            new Thread(new Runnable() {
                public void run() {
                    animator.stop();
                    System.exit(0);
                }
            }).start();
        }
    });

    frame.setVisible(true);
    frame.pack();
    animator.start();
}
 
Example #11
Source File: GLChartPanel.java    From MeteoInfo with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 * Start animator
 */
public void animator_start() {
    animator = new FPSAnimator(this, 300, true);
    animator.start();
}