Jump to content
  • Advertisement
Sign in to follow this  
spree

OpenGL Manual 2D rotation algorithem bug :(

This topic is 4714 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, we were given an assigment to write a manual rotation algorithem in OpenGL.( not to use glRotate...) Each of my objects (Circles) consist of a stl vector (array) which holds all of the vertices of the circle. My problem is that the rotation algorithem is also scaling my objects down. And i dont know why :/ Here is the rotation algorithem
// Rotates the object on the Z axis
void Shape::RotateZ()
{
	Point *p;//for conviniance

	//convert the degree to radians
	float radAng = DEGTORAD(m_fRotateAngle);

	for(unsigned int i=0;i<m_vVertex.size();i++)
	{ //RotationMatrix x vertexVector
		p=m_vVertex;

		p->x=cos(radAng)*(p->x)-sin(radAng)*(p->y);
		p->y=sin(radAng)*(p->x)+cos(radAng)*(p->y);
		
	}
}


Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!