From 84156a4c6ae648f51e008d1176409bdcb0b038cd Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Fri, 12 Dec 2008 02:04:56 +0000 Subject: 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 --- src/demos/gears/Gears.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/demos') 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) {} } - -- cgit v1.2.3