ThunderSoul

06-08-2005, 09:43 PM

Hello all...

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]

?

Thank you...

-TS...

J.R. Hass

06-08-2005, 10:18 PM

Check out the glRotate function call in the OpenGL Redbook (http://www.rush3d.com/reference/opengl-redbook-1.1/chapter03.html)

-jR

Ehsan Kamrani

06-09-2005, 05: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 );

-Ehsan-

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.