diff options
author | Kenneth Russel <[email protected]> | 2008-12-12 02:04:56 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2008-12-12 02:04:56 +0000 |
commit | 84156a4c6ae648f51e008d1176409bdcb0b038cd (patch) | |
tree | ed2b06e5a14feee0c62b118cb803cf8fd789d0ff /src/demos | |
parent | 19a886bd801c5608bf258615608a0d9f1f0b1596 (diff) |
Fixed breakage of GLJPanel caused by confusion between requested and
chosen GLCapabilities. Separated these out and refactored requested
GLCapabilities into GLDrawableImpl superclass. Removed
setChosenGLCapabilities from the public API and made it protected on
GLDrawableImpl. Removed it from all public GLDrawable implementations
such as GLCanvas and GLJPanel. Fixed bug in Gears demo where mouse
listener was not being hooked up correctly. Tested so far on Windows;
testing on other platforms to follow.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@303 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos')
-rw-r--r-- | src/demos/gears/Gears.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/demos/gears/Gears.java b/src/demos/gears/Gears.java index c20d183..6b646fe 100644 --- a/src/demos/gears/Gears.java +++ b/src/demos/gears/Gears.java @@ -11,6 +11,7 @@ import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; +import javax.media.opengl.awt.AWTGLAutoDrawable; import javax.media.opengl.awt.GLCanvas; import javax.media.opengl.awt.gl2.GL2JPanel; import javax.media.opengl.util.Animator; @@ -28,8 +29,6 @@ public class Gears implements GLEventListener, MouseListener, MouseMotionListene GLCanvas canvas = new GLCanvas(); final Gears gears = new Gears(); - canvas.addMouseListener(gears); - canvas.addMouseMotionListener(gears); canvas.addGLEventListener(gears); frame.add(canvas); @@ -103,6 +102,11 @@ public class Gears implements GLEventListener, MouseListener, MouseMotionListene gl.glEnable(GL2.GL_NORMALIZE); + if (drawable instanceof AWTGLAutoDrawable) { + AWTGLAutoDrawable awtDrawable = (AWTGLAutoDrawable) drawable; + awtDrawable.addMouseListener(this); + awtDrawable.addMouseMotionListener(this); + } } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { @@ -328,4 +332,3 @@ public class Gears implements GLEventListener, MouseListener, MouseMotionListene public void mouseMoved(MouseEvent e) {} } - |