Advertisement
loloof64

simple opengl test

Mar 8th, 2012
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.92 KB | None | 0 0
  1. package com.gmail.bernabe.laurent.jogl.simple_test;
  2.  
  3. import java.awt.Frame;
  4. import java.awt.event.WindowAdapter;
  5. import java.awt.event.WindowEvent;
  6.  
  7. import javax.media.opengl.awt.GLCanvas;
  8.  
  9. import com.jogamp.opengl.util.Animator;
  10.  
  11. public class SimpleTest extends Frame {
  12.  
  13.  
  14.     public SimpleTest(){
  15.         setTitle("simple test OpenGL");
  16.         setSize(300, 300);
  17.         setLocationRelativeTo(null);
  18.        
  19.         GLCanvas canvas3D = new GLCanvas();
  20.         canvas3D.addGLEventListener(new MyGLEventListener());
  21.         add(canvas3D);
  22.        
  23.         final Animator animator = new Animator(canvas3D);
  24.        
  25.         addWindowListener(new WindowAdapter() {
  26.  
  27.             @Override
  28.             public void windowClosing(WindowEvent event) {
  29.                 animator.stop();
  30.                 System.exit(0);
  31.             }
  32.            
  33.         });
  34.        
  35.         animator.start();
  36.     }
  37.    
  38.     public static void main(String[] args) {
  39.         new SimpleTest().setVisible(true);
  40.     }
  41.    
  42.     private static final long serialVersionUID = -3365940389896758499L;
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement