Package com.jogamp.opengl.util

Examples of com.jogamp.opengl.util.FPSAnimator


                //Create the OpenGL rendering canvas
                GLCanvas canvas = new NormansAdventure();
                canvas.setPreferredSize( new Dimension(CANVAS_WIDTH, CANVAS_HEIGHT));
               
                // Create an animator that drives canvas' display() at the specified FPS
                final FPSAnimator animator = new FPSAnimator(canvas, FPS, true);
               
                //Create the top-level container
                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 dedicated thread to run the stop() to ensure the animator
                        // thread stops before program exists.
                        new Thread() {
                            @Override
                            public void run() {
                                if (animator.isStarted()) animator.stop();
                                System.exit(0);
                            }
                        }.start();
                    }
                });
                frame.setTitle(TITLE);
                frame.pack();
                frame.setVisible(true);
                animator.start(); // Start the animation loop
            }
        });
    }
View Full Code Here

TOP

Related Classes of com.jogamp.opengl.util.FPSAnimator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.