summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/demos/vertexBufferObject/VertexBufferObject.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/demos/vertexBufferObject/VertexBufferObject.java b/src/demos/vertexBufferObject/VertexBufferObject.java
index b9590cc..2cf9fa4 100644
--- a/src/demos/vertexBufferObject/VertexBufferObject.java
+++ b/src/demos/vertexBufferObject/VertexBufferObject.java
@@ -50,6 +50,7 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLProfile;
+import javax.media.opengl.awt.AWTGLAutoDrawable;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;
import javax.media.opengl.util.Animator;
@@ -100,16 +101,10 @@ public class VertexBufferObject extends Demo {
}
GLProfile.setProfile("GL2");
GLCanvas canvas = new GLCanvas();
- final VertexBufferObject demo = new VertexBufferObject();
+ VertexBufferObject demo = new VertexBufferObject();
demo.vboEnabled = vboEnabled;
canvas.addGLEventListener(demo);
- canvas.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
- demo.dispatchKey(e.getKeyChar());
- }
- });
-
final Animator animator = new Animator(canvas);
animator.setRunAsFastAsPossible(true);
demo.setDemoListener(new DemoListener() {
@@ -351,6 +346,14 @@ public class VertexBufferObject extends Demo {
computeElements(gl);
+ if (drawable instanceof AWTGLAutoDrawable) {
+ ((AWTGLAutoDrawable) drawable).addKeyListener(new KeyAdapter() {
+ public void keyTyped(KeyEvent e) {
+ dispatchKey(e.getKeyChar());
+ }
+ });
+ }
+
initComplete = true;
}