We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › stopping a rotation
Page Index Toggle Pages: 1
stopping a rotation (Read 478 times)
stopping a rotation
Apr 7th, 2006, 11:03pm
 
Say I have a sphere that you can rotate freely with the mouse, and on top of that sphere I wanted a small ellipse with a crosshair on it as a static anchor to slelect areas of the sphere, how can I write the draw() part so the rotate() part doesn't affect the crosshair?

At the moment, the ellipse I draw moves with the sphere in the rotation!

thanks for anyone who can help

R
Re: stopping a rotation
Reply #1 - Apr 7th, 2006, 11:32pm
 
pushMatrix() and popMatrix willhelp you do what you want.

They basicly save and load rotation/translation states.

So if you do a pushMatrix() before you draw the sphere, then a popMatrix() once you've drawn it, you should be able to draw the ellipse as if the sphere had never been rotated.
Re: stopping a rotation
Reply #2 - Apr 8th, 2006, 10:34am
 
Thanks for the speedy reply!

The ellipse I've drawn is now static but it's behind the rotating sphere. Is there anyway to bring it to the front, so it's almost like a static cursor over the top of this sphere?

-R
Re: stopping a rotation
Reply #3 - Apr 8th, 2006, 12:15pm
 
Add a translate(0,0,50); or possibly a larger value before the ellipse call, that'll move it closer to the camera.
Re: stopping a rotation
Reply #4 - Apr 8th, 2006, 6:50pm
 
Many thanks.

Issue solved!
Page Index Toggle Pages: 1