Hi,
Could anyone please help me out here?
I have the top left corner co ordinates of a rectangle. And also the width and height. Now, say, I want to rotate the rectangle 30 deg with the top left vertex as it s axis. How do I calculate the four vertices.
I'm trying to do this in opengl without using the glRotatef function, but for some reason the texture gets distorted with the rectangle rotates.
I'm currently using this logic.
currentTopLeftX = Vertices[ 0 ].x;
currentTopLeftY = Vertices[ 0 ].y;
currentTopRightX = Vertices[ 0 ].x + w*cos(angle*PI/180);
currentTopRightY = Vertices[ 0 ].y + w*sin(angle*PI/180);
currentBottomRightX = Vertices[ 0 ].x + w*cos(angle*PI/180) - h*sin(angle*PI/180);
currentBottomRightY = Vertices[ 0 ].y + w*sin(angle*PI/180) - h*cos(angle*PI/180);
currentBottomLeftX = Vertices[ 0 ].x + h*sin(angle*PI/180);
currentBottomLeftY = Vertices[ 0 ].y + h*cos(angle*PI/180);