06-08-2005, 08:43 PM
How would I go about using a matrix rotation in openGL?
For example, the rotation around the x axis:
[1 0 0 0
0 cosA -sinA 0
0 sinA cosA 0
0 0 0 1]
06-08-2005, 09:18 PM
Check out the glRotate function call in the OpenGL Redbook (http://www.rush3d.com/reference/opengl-redbook-1.1/chapter03.html)
06-09-2005, 04:34 AM
This matrix help you to understand the meaning of the rotation around an axis. OpenGL multiplies such matrices to the current modelview matrix--You don't need to do this.
To rotate around the x axis, use from the following function:
glRotatef( angle, 1,0,0 );
and to rotate around the y axis:
glRotatef( angle, 0,1,0 );
and finally to rotate around the z axis:
glRotatef( angle, 0,0,1 );
to rotate around the vector (nx,ny,nz )use from the following function call:
glRotatef( angle, nx,ny,nz );
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.