From 15bc81d1e89d16e7f462f13acb554d4df27fa1b8 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sun, 10 Jul 2005 23:17:52 +0000 Subject: Initial set of context-related changes for the JSR-231 API. GLContext has been exposed in the public API. The GLEventListener callback mechanism has been removed from the core GLContext implementation and moved up to a higher level. GLAutoDrawable now contains the GLEventListener-related methods, and the GLEventListener's methods now receive a GLAutoDrawable as argument. All JOGL demos have been updated for the new APIs. Many FIXMEs and much unimplemented functionality remain. There is slightly different initialization behavior for the demos containing pbuffers, and the deferring of reshape callbacks needs to be rethought. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JSR-231@100 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4 --- src/gleem/ExaminerViewer.java | 45 +++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'src/gleem/ExaminerViewer.java') diff --git a/src/gleem/ExaminerViewer.java b/src/gleem/ExaminerViewer.java index 9760165..e60d4f7 100644 --- a/src/gleem/ExaminerViewer.java +++ b/src/gleem/ExaminerViewer.java @@ -50,7 +50,7 @@ import net.java.games.jogl.*; manipulator hierarchy. It is an example of how you might integrate gleem with another application which uses the mouse.

-

For the given GLDrawable, the ExaminerViewer takes over the +

For the given GLAutoDrawable, the ExaminerViewer takes over the setting of the view position. It passes along mouse events it is not interested in to the ManipManager's mouse routines.

@@ -71,7 +71,7 @@ import net.java.games.jogl.*; button.

*/ public class ExaminerViewer { - private GLDrawable window; + private GLAutoDrawable window; /** Simple state machine for figuring out whether we are grabbing events */ private boolean interactionUnderway; @@ -125,12 +125,12 @@ public class ExaminerViewer { }; private GLEventListener glListener = new GLEventListener() { - public void init(GLDrawable drawable) {} - public void display(GLDrawable drawable) {} - public void reshape(GLDrawable drawable, int x, int y, int width, int height) { + public void init(GLAutoDrawable drawable) {} + public void display(GLAutoDrawable drawable) {} + public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { reshapeMethod(width, height); } - public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) {} + public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} }; /** The constructor takes the number of mouse buttons on this system @@ -140,17 +140,17 @@ public class ExaminerViewer { oldNumMouseButtons = numMouseButtons; } - /**

Attaches this ExaminerViewer to the given GLDrawable. This + /**

Attaches this ExaminerViewer to the given GLAutoDrawable. This causes the ManipManager's mouse routines to be removed from the window (using ManipManager.removeMouseListeners) and the - ExaminerViewer's to be installed. The GLDrawable should be + ExaminerViewer's to be installed. The GLAutoDrawable should be registered with the ManipManager before the ExaminerViewer is attached to it.

In order for the viewer to do anything useful, you need to provide a BSphereProvider to it to allow "view all" functionality.

*/ - public void attach(GLDrawable window, BSphereProvider provider) { + public void attach(GLAutoDrawable window, BSphereProvider provider) { this.window = window; this.provider = provider; init(); @@ -158,7 +158,7 @@ public class ExaminerViewer { } /** Detaches from the given window. This causes the ManipManager's - mouse listeners to be reinstalled on the GLDrawable and the + mouse listeners to be reinstalled on the GLAutoDrawable and the ExaminerViewer's to be removed. */ public void detach() { removeListeners(); @@ -355,9 +355,8 @@ public class ExaminerViewer { button1Down = false; button2Down = false; - Dimension size = window.getSize(); - int xSize = size.width; - int ySize = size.height; + int xSize = window.getWidth(); + int ySize = window.getHeight(); params.setOrientation(orientation); params.setPosition(computePosition(new Vec3f())); params.setForwardDirection(Vec3f.NEG_Z_AXIS); @@ -411,10 +410,12 @@ public class ExaminerViewer { } - // Force redraw if window will not do it automatically - if (!window.getNoAutoRedrawMode()) { - window.display(); - } + // Force redraw + // FIXME: this can cause bad behavior (slowdowns, jittery + // rendering) if window is being automatically rendered; should + // have flag to disable auto redraw by the examiner viewer, + // since that API isn't present in the GLDrawable any more + window.display(); } } @@ -471,10 +472,12 @@ public class ExaminerViewer { iOwnInteraction = false; } - // Force redraw if window will not do it automatically - if (!window.getNoAutoRedrawMode()) { - window.display(); - } + // Force redraw + // FIXME: this can cause bad behavior (slowdowns, jittery + // rendering) if window is being automatically rendered; should + // have flag to disable auto redraw by the examiner viewer, + // since that API isn't present in the GLDrawable any more + window.display(); } } -- cgit v1.2.3