diff options
author | Kenneth Russel <[email protected]> | 2005-07-17 06:13:30 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-07-17 06:13:30 +0000 |
commit | 6f2bdbacf131b05937925fbfe32ac0b603ccbcc6 (patch) | |
tree | c4b54e3602f91a90cfb0fbc7d14e01fa89a32ac8 /src/gleem/ManipManager.java | |
parent | 15bc81d1e89d16e7f462f13acb554d4df27fa1b8 (diff) |
Further context-related changes for the JSR-231 API. The GLContext
implementations on all platforms have been split into orthogonal
GLDrawable and GLContext concepts. It is now possible to create more
than one GLContet per GLDrawable (though this has not been tested
yet). GLCanvas has been reimplemented in terms of
GLDrawableFactory.getGLDrawable(). More functionality has been moved
from GLDrawable to GLAutoDrawable. Reimplemented lazy sending of
reshape GLEventListener events in GLCanvas and GLJPanel and deleted
notion of deferred reshapes from GLDrawableHelper and elsewhere.
Sharing of textures and display lists is now expressed in terms of
GLContexts instead of GLDrawables. Still need to move pbuffer creation
into GLDrawableFactory from the onscreen GLContext implementations.
Added option to gleem ExaminerViewer to disable automatic redraws upon
mouse events and respecified more of gleem to work on GLAutoDrawables
rather than GLDrawables. Updated all JOGL demos to work with new APIs
and slightly different initialization sequences (in particular, for
pbuffers -- this will change with the addition of
GLDrawableFactory.createGLPbuffer()).
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JSR-231@103 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/gleem/ManipManager.java')
-rw-r--r-- | src/gleem/ManipManager.java | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/gleem/ManipManager.java b/src/gleem/ManipManager.java index 439d4fa..e29edfe 100644 --- a/src/gleem/ManipManager.java +++ b/src/gleem/ManipManager.java @@ -55,7 +55,7 @@ public class ManipManager { private static ManipManager soleInstance; // Maps GLDrawables to WindowInfos private Map windowToInfoMap = new HashMap(); - // Maps Manips to Set<GLDrawable> + // Maps Manips to Set<GLAutoDrawable> private Map manipToWindowMap = new HashMap(); // MouseAdapter for this @@ -78,7 +78,7 @@ public class ManipManager { } }; private WindowUpdateListener defaultWindowListener = new WindowUpdateListener() { - public void update(GLDrawable window) { + public void update(GLAutoDrawable window) { window.display(); } }; @@ -108,14 +108,14 @@ public class ManipManager { /** Make the ManipManager aware of the existence of a given window. This causes mouse and mouse motion listeners to be installed on this window; see setupMouseListeners, below. */ - public synchronized void registerWindow(GLDrawable window) { + public synchronized void registerWindow(GLAutoDrawable window) { windowToInfoMap.put(window, new WindowInfo()); setupMouseListeners(window); } /** Remove all references to a given window, including removing all manipulators from it. */ - public synchronized void unregisterWindow(GLDrawable window) { + public synchronized void unregisterWindow(GLAutoDrawable window) { WindowInfo info = (WindowInfo) windowToInfoMap.get(window); for (Iterator iter = info.manips.iterator(); iter.hasNext(); ) { removeManipFromWindow((Manip) iter.next(), window); @@ -126,7 +126,7 @@ public class ManipManager { /** Make a given manipulator visible and active in a given window. The window must be registered. */ - public synchronized void showManipInWindow(Manip manip, GLDrawable window) { + public synchronized void showManipInWindow(Manip manip, GLAutoDrawable window) { WindowInfo info = (WindowInfo) windowToInfoMap.get(window); if (info == null) { throw new RuntimeException("Window not registered"); @@ -142,7 +142,7 @@ public class ManipManager { /** Remove a given manipulator from a given window. The window must be registered. */ - public synchronized void removeManipFromWindow(Manip manip, GLDrawable window) { + public synchronized void removeManipFromWindow(Manip manip, GLAutoDrawable window) { WindowInfo info = (WindowInfo) windowToInfoMap.get(window); if (info == null) { throw new RuntimeException("Window not registered"); @@ -157,7 +157,7 @@ public class ManipManager { /** This must be called for a registered window every time the camera parameters of the window change. */ - public synchronized void updateCameraParameters(GLDrawable window, CameraParameters params) { + public synchronized void updateCameraParameters(GLAutoDrawable window, CameraParameters params) { WindowInfo info = (WindowInfo) windowToInfoMap.get(window); if (info == null) { throw new RuntimeException("Window not registered"); @@ -180,7 +180,7 @@ public class ManipManager { repainting of windows in which manipulators have moved. The default implementation, which can be restored by passing a null listener argument to this method, calls repaint() on the - GLDrawable if it is not a GLRunnable instance (i.e., a + GLAutoDrawable if it is not a GLRunnable instance (i.e., a GLAnimCanvas or GLAnimJPanel, which redraw themselves automatically). */ public synchronized void setWindowUpdateListener(WindowUpdateListener listener) { @@ -195,7 +195,7 @@ public class ManipManager { drawing occurs immediately; this routine must be called when an OpenGL context is valid, i.e., from within the display() method of a GLEventListener. */ - public synchronized void render(GLDrawable window, GL gl) { + public synchronized void render(GLAutoDrawable window, GL gl) { WindowInfo info = (WindowInfo) windowToInfoMap.get(window); if (info == null) { throw new RuntimeException("Window not registered"); @@ -212,7 +212,7 @@ public class ManipManager { listeners for the canvas (see the ExaminerViewer class), the setupMouseListeners and removeMouseListeners routines, as well as the appropriate delegate routines, are made public here. */ - public synchronized void setupMouseListeners(GLDrawable window) { + public synchronized void setupMouseListeners(GLAutoDrawable window) { window.addMouseMotionListener(mouseMotionListener); window.addMouseListener(mouseListener); } @@ -220,7 +220,7 @@ public class ManipManager { /** Removes the automatically-installed mouse listeners for the given window. This allows application code to determine the policy for intercepting mouse events. */ - public synchronized void removeMouseListeners(GLDrawable window) { + public synchronized void removeMouseListeners(GLAutoDrawable window) { window.removeMouseMotionListener(mouseMotionListener); window.removeMouseListener(mouseListener); } @@ -230,7 +230,7 @@ public class ManipManager { are exposed so application-level code can intercept events when certain modifier keys are depressed. */ public synchronized void mouseMoved(MouseEvent e) { - passiveMotionMethod((GLDrawable) e.getComponent(), e.getX(), e.getY()); + passiveMotionMethod((GLAutoDrawable) e.getComponent(), e.getX(), e.getY()); } /** The ManipManager watches for the following events: mouseMoved, @@ -238,7 +238,7 @@ public class ManipManager { are exposed so application-level code can intercept events when certain modifier keys are depressed. */ public synchronized void mouseDragged(MouseEvent e) { - motionMethod((GLDrawable) e.getComponent(), e.getX(), e.getY()); + motionMethod((GLAutoDrawable) e.getComponent(), e.getX(), e.getY()); } /** The ManipManager watches for the following events: mouseMoved, @@ -246,7 +246,7 @@ public class ManipManager { are exposed so application-level code can intercept events when certain modifier keys are depressed. */ public synchronized void mousePressed(MouseEvent e) { - mouseMethod((GLDrawable) e.getComponent(), e.getModifiers(), + mouseMethod((GLAutoDrawable) e.getComponent(), e.getModifiers(), true, e.getX(), e.getY()); } @@ -255,7 +255,7 @@ public class ManipManager { are exposed so application-level code can intercept events when certain modifier keys are depressed. */ public synchronized void mouseReleased(MouseEvent e) { - mouseMethod((GLDrawable) e.getComponent(), e.getModifiers(), + mouseMethod((GLAutoDrawable) e.getComponent(), e.getModifiers(), false, e.getX(), e.getY()); } @@ -268,7 +268,7 @@ public class ManipManager { setWindowUpdateListener(null); } - private void motionMethod(GLDrawable window, int x, int y) { + private void motionMethod(GLAutoDrawable window, int x, int y) { WindowInfo info = (WindowInfo) windowToInfoMap.get(window); if (info.dragging) { // Compute ray in 3D @@ -280,7 +280,7 @@ public class ManipManager { } } - private void passiveMotionMethod(GLDrawable window, int x, int y) { + private void passiveMotionMethod(GLAutoDrawable window, int x, int y) { WindowInfo info = (WindowInfo) windowToInfoMap.get(window); // Compute ray in 3D Vec3f rayStart = new Vec3f(); @@ -320,7 +320,7 @@ public class ManipManager { } } - private void mouseMethod(GLDrawable window, int modifiers, + private void mouseMethod(GLAutoDrawable window, int modifiers, boolean isPress, int x, int y) { if ((modifiers & InputEvent.BUTTON1_MASK) != 0) { WindowInfo info = (WindowInfo) windowToInfoMap.get(window); @@ -396,7 +396,7 @@ public class ManipManager { Set windows = (Set) manipToWindowMap.get(manip); assert windows != null; for (Iterator iter = windows.iterator(); iter.hasNext(); ) { - windowListener.update((GLDrawable) iter.next()); + windowListener.update((GLAutoDrawable) iter.next()); } } } |