diff options
Diffstat (limited to 'src/gleem')
-rw-r--r-- | src/gleem/ExaminerViewer.java | 45 | ||||
-rw-r--r-- | src/gleem/ManipManager.java | 4 | ||||
-rw-r--r-- | src/gleem/TestExaminerViewer.java | 8 | ||||
-rw-r--r-- | src/gleem/TestHandleBox.java | 8 | ||||
-rw-r--r-- | src/gleem/TestMultiWin.java | 8 | ||||
-rw-r--r-- | src/gleem/TestTranslate1.java | 8 | ||||
-rw-r--r-- | src/gleem/TestTranslate2.java | 8 |
7 files changed, 45 insertions, 44 deletions
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. </P> - <P> For the given GLDrawable, the ExaminerViewer takes over the + <P> 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. </P> @@ -71,7 +71,7 @@ import net.java.games.jogl.*; button. </P> */ 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; } - /** <P> Attaches this ExaminerViewer to the given GLDrawable. This + /** <P> 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. </P> <P> In order for the viewer to do anything useful, you need to provide a BSphereProvider to it to allow "view all" functionality. </P> */ - 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(); } } diff --git a/src/gleem/ManipManager.java b/src/gleem/ManipManager.java index 0a0d86d..439d4fa 100644 --- a/src/gleem/ManipManager.java +++ b/src/gleem/ManipManager.java @@ -79,9 +79,7 @@ public class ManipManager { }; private WindowUpdateListener defaultWindowListener = new WindowUpdateListener() { public void update(GLDrawable window) { - if (!window.getNoAutoRedrawMode()) { - window.display(); - } + window.display(); } }; private WindowUpdateListener windowListener; diff --git a/src/gleem/TestExaminerViewer.java b/src/gleem/TestExaminerViewer.java index 3ba68e4..d793846 100644 --- a/src/gleem/TestExaminerViewer.java +++ b/src/gleem/TestExaminerViewer.java @@ -77,7 +77,7 @@ public class TestExaminerViewer { private CameraParameters params = new CameraParameters(); private ExaminerViewer viewer; - public void init(GLDrawable drawable) { + public void init(GLAutoDrawable drawable) { gl = drawable.getGL(); glu = drawable.getGLU(); @@ -122,7 +122,7 @@ public class TestExaminerViewer { viewer.viewAll(gl); } - public void display(GLDrawable drawable) { + public void display(GLAutoDrawable drawable) { gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); viewer.update(gl); ManipManager.getManipManager().updateCameraParameters(drawable, viewer.getCameraParameters()); @@ -130,8 +130,8 @@ public class TestExaminerViewer { } // Unused routines - public void reshape(GLDrawable drawable, int x, int y, int w, int h) {} - public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) {} + public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {} + public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} } public static void main(String[] args) { diff --git a/src/gleem/TestHandleBox.java b/src/gleem/TestHandleBox.java index 0761c8b..e47c1ab 100644 --- a/src/gleem/TestHandleBox.java +++ b/src/gleem/TestHandleBox.java @@ -55,7 +55,7 @@ public class TestHandleBox { private GLU glu; private CameraParameters params = new CameraParameters(); - public void init(GLDrawable drawable) { + public void init(GLAutoDrawable drawable) { gl = drawable.getGL(); glu = drawable.getGLU(); @@ -95,13 +95,13 @@ public class TestHandleBox { manager.showManipInWindow(manip, drawable); } - public void display(GLDrawable drawable) { + public void display(GLAutoDrawable drawable) { gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); ManipManager.getManipManager().updateCameraParameters(drawable, params); ManipManager.getManipManager().render(drawable, gl); } - public void reshape(GLDrawable drawable, int x, int y, int w, int h) { + public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { float aspect, theta; aspect = (float) w / (float) h; if (w >= h) @@ -120,7 +120,7 @@ public class TestHandleBox { } // Unused routines - public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) {} + public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} } public static void main(String[] args) { diff --git a/src/gleem/TestMultiWin.java b/src/gleem/TestMultiWin.java index 4b9fa58..7a9fe14 100644 --- a/src/gleem/TestMultiWin.java +++ b/src/gleem/TestMultiWin.java @@ -79,7 +79,7 @@ public class TestMultiWin { private CameraParameters params = new CameraParameters(); private ExaminerViewer viewer; - public void init(GLDrawable drawable) { + public void init(GLAutoDrawable drawable) { gl = drawable.getGL(); glu = drawable.getGLU(); @@ -121,7 +121,7 @@ public class TestMultiWin { viewer.viewAll(gl); } - public void display(GLDrawable drawable) { + public void display(GLAutoDrawable drawable) { gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); viewer.update(gl); ManipManager.getManipManager().updateCameraParameters(drawable, viewer.getCameraParameters()); @@ -129,8 +129,8 @@ public class TestMultiWin { } // Unused routines - public void reshape(GLDrawable drawable, int x, int y, int w, int h) {} - public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) {} + public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {} + public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} } private static void showFrame(String name, Point location) { diff --git a/src/gleem/TestTranslate1.java b/src/gleem/TestTranslate1.java index 79fb4ca..086e3a7 100644 --- a/src/gleem/TestTranslate1.java +++ b/src/gleem/TestTranslate1.java @@ -55,7 +55,7 @@ public class TestTranslate1 { private GLU glu; private CameraParameters params = new CameraParameters(); - public void init(GLDrawable drawable) { + public void init(GLAutoDrawable drawable) { gl = drawable.getGL(); glu = drawable.getGLU(); @@ -96,13 +96,13 @@ public class TestTranslate1 { manager.showManipInWindow(manip, drawable); } - public void display(GLDrawable drawable) { + public void display(GLAutoDrawable drawable) { gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); ManipManager.getManipManager().updateCameraParameters(drawable, params); ManipManager.getManipManager().render(drawable, gl); } - public void reshape(GLDrawable drawable, int x, int y, int w, int h) { + public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { float aspect, theta; aspect = (float) w / (float) h; if (w >= h) @@ -121,7 +121,7 @@ public class TestTranslate1 { } // Unused routines - public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) {} + public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} } public static void main(String[] args) { diff --git a/src/gleem/TestTranslate2.java b/src/gleem/TestTranslate2.java index 0906d8f..70a0041 100644 --- a/src/gleem/TestTranslate2.java +++ b/src/gleem/TestTranslate2.java @@ -55,7 +55,7 @@ public class TestTranslate2 { private GLU glu; private CameraParameters params = new CameraParameters(); - public void init(GLDrawable drawable) { + public void init(GLAutoDrawable drawable) { gl = drawable.getGL(); glu = drawable.getGLU(); @@ -96,13 +96,13 @@ public class TestTranslate2 { manager.showManipInWindow(manip, drawable); } - public void display(GLDrawable drawable) { + public void display(GLAutoDrawable drawable) { gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); ManipManager.getManipManager().updateCameraParameters(drawable, params); ManipManager.getManipManager().render(drawable, gl); } - public void reshape(GLDrawable drawable, int x, int y, int w, int h) { + public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) { float aspect, theta; aspect = (float) w / (float) h; if (w >= h) @@ -121,7 +121,7 @@ public class TestTranslate2 { } // Unused routines - public void displayChanged(GLDrawable drawable, boolean modeChanged, boolean deviceChanged) {} + public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {} } public static void main(String[] args) { |