Jogamp
Bug 682 - Relocating javax.media.opengl.* -> com.jogamp.opengl.* (Part 2)
[jogl-demos.git] / maven / jp4da / jp4da-desktop / src / main / java / com / io7m / examples / jp4da / DesktopExample.java
CommitLineData
76da2b16
MR
1package com.io7m.examples.jp4da;
2
60675480
SG
3import com.jogamp.opengl.GLCapabilities;
4import com.jogamp.opengl.GLEventListener;
5import com.jogamp.opengl.GLProfile;
76da2b16
MR
6
7import com.jogamp.newt.opengl.GLWindow;
8import com.jogamp.opengl.util.FPSAnimator;
9
10public class DesktopExample implements Runnable
11{
12 public static void main(
13 final String args[])
14 {
15 final DesktopExample de = new DesktopExample(new Example());
16 de.run();
17 }
18
19 private final GLWindow window;
20 private final FPSAnimator animator;
21
22 private DesktopExample(
23 final GLEventListener gle)
24 {
25 final GLProfile pro = GLProfile.get(GLProfile.GL2GL3);
26 final GLCapabilities cap = new GLCapabilities(pro);
27
28 this.window = GLWindow.create(cap);
29 this.window.setSize(640, 480);
30 this.window.setTitle("Test1");
31 this.window.addGLEventListener(gle);
32 this.window.setVisible(true);
33
34 this.animator = new FPSAnimator(60);
35 this.animator.setUpdateFPSFrames(60, System.err);
36 this.animator.add(this.window);
37 this.animator.start();
38 }
39
40 @Override public void run()
41 {
42 try {
43 while (this.animator.isAnimating() && this.window.isVisible()) {
44 Thread.sleep(100);
45 }
46
47 this.animator.stop();
48 this.window.destroy();
49
50 System.err.println("Exiting...");
51 } catch (final InterruptedException e) {
52 e.printStackTrace();
53 System.exit(1);
54 }
55 }
56}
http://JogAmp.org git info: FAQ, tutorial and man pages.