diff options
author | Kenneth Russel <[email protected]> | 2008-12-20 08:58:58 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2008-12-20 08:58:58 +0000 |
commit | db0a8ad5863b6fad1520677d8a52c99ea88139e1 (patch) | |
tree | 02eecbcea6016105c9f784980fb486c83b82a84f /src/demos/vertexBufferObject | |
parent | 169e8a51a4a6a7b0fa2e72970ec66a405238bcd3 (diff) |
Fixed bug in setup of key handling
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@307 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos/vertexBufferObject')
-rw-r--r-- | src/demos/vertexBufferObject/VertexBufferObject.java | 17 |
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; } |