View Full Version : how to rotate a polygon around a vertex

Last One Left
03-10-2012, 07:49 AM
hello guyz , i am a new user of the opengl GLUT library
and i wanna know how to rotate a polygon around a vertex and not the origin , using the glut library.
plz help

03-10-2012, 08:20 AM
Move it so that the vertex you want to rotate around is the origin, rotate, move it back. This is independent of GLUT.

And please post a question only once.

Last One Left
03-10-2012, 09:00 AM
assume that i want to move it around a vertex which coordinates are (20,60) how to do it like that , and without that vertex to the origin ?

03-10-2012, 10:01 AM
As I told you, translate by (-20,-60), rotate, translate back (20,60). In the end this will also just be one transformation matrix for the GPU (that you can create on your own or by the old fixed-function glTranslate/glRotate/glTranslate calls).

03-10-2012, 04:11 PM
Are you able to display your polygon and point yet without any rotation? If so, post your code. I think you'll get a lot more help if you post your code and tell us exactly how far you've gotten so far. Remember to place the code inside [CODE] and [\code] tags (except with a forward slash instead of a backslash).