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 › Rotating a PImage Sprite w/o Rotating Background
Page Index Toggle Pages: 1
Rotating a PImage Sprite w/o Rotating Background (Read 1128 times)
Rotating a PImage Sprite w/o Rotating Background
Jan 14th, 2010, 3:07pm
 
Hello,
I'm trying to rotate a PImage sprite, without rotating the entire stage.

A few people have extended the PImage class to inlcude a rotate method, but they all call rotate(), which rotates the entire world, not just the PImage.
Any idea?
Re: Rotating a PImage Sprite w/o Rotating Background
Reply #1 - Jan 14th, 2010, 3:12pm
 
pushMatrix();
rotate(angle);
//draw image
popMatrix();

and some translates to make it rotate around your rotationcenter of choice
Re: Rotating a PImage Sprite w/o Rotating Background
Reply #2 - Jan 15th, 2010, 4:56am
 
Findus1 wrote on Jan 14th, 2010, 3:07pm:
they all call rotate(), which rotates the entire world, not just the PImage.

Yes, it might not seem intuitive, but that's the way most computer graphics work... Instead of rotating a photo, you take the whole world, rotate it, put down the photo, then rotate back the world! Smiley
Page Index Toggle Pages: 1