rotating objects w/ mouse

I have a question when rotating objects with a mouse. I have a small object shaped like a pen that I imported from a CAD file. I then render this object on screen and I can click anywhere’s on the screen to rotate it.

My problem is that, after I click and drag the mouse, my object moves, then I let up on the mouse button. Now the next time I click on the left mouse button and drag, my object completely jumps around starting from another angle and so it just doesn’t appear to rotate smoothly in between clicks.

Is there anything on how this should be done smoothly, or at least correctly? Any help, much appreciated.

[quote]I have a question when rotating objects with a mouse. I have a small object shaped like a pen that I imported from a CAD file. I then render this object on screen and I can click anywhere’s on the screen to rotate it.
[/quote]
Hi, when you say “rotate it”, do you mean rotate the object around a world defined axis or an object define axis…
Depending on what you are doing you may want to store an attribute defining your rotation angle for your object or move the camera…
There are a lot of ways to achieve things like that!

Take a look at the ExaminerViewer class in the gleem package which is in the jogl-demos source tree. It implements what you are looking for (zooming, panning, and rotating).

See this page for docs on an older gleem package. The current sources are maintained in the jogl-demos tree.

[quote]1) Am I correct in understanding it only works w/ perspective projection and not orthographic?
[/quote]
Yes, currently it expects a perspective projection though it could be changed to handle orthographic projections (without rewriting the whole library – see the CameraParameters, ScreenToRayMapping and RightTruncPyrMapping classes).

[quote]My stuff compiles fine after I do the 6 steps for “Incorporating Manips into a Java Program”, but my canvas goes totally white and nothing works.

But if it did work, am I to expect that by adding those manipulators, then the model in my display() method would work in the same way that … say … if I added TestTranslate1 would work (which is the Tranlate1Manip)?

I left my working code unchanged (well, mostly unchanged), and I’m afraid all my current gl.(calls) might be interferring w/ the manipulator code, or something, cause my models don’t appear now.
[/quote]
gleem’s manipulators don’t make many assumptions about OpenGL state though I think you probably will need to disable texturing and re-enable it around your call to ManipManager.render(). Aside from that I would srongly recommend you look at some of the JOGL demos like the HWShadowmapsSimple demo which use the manipulators and ExaminerViewer class.