NeatRobot
NeatRobot

Reputation: 73

Using axis and angle of rotation in glrotate

I followed the question here Quaternion math for rotation? to get an angle of rotation and the axis around which I need to rotate, My question is how do I pass the angle and axis as an argument to glrotate()?

Upvotes: 0

Views: 2780

Answers (2)

Ewan Todd
Ewan Todd

Reputation: 7312

The double version is

glRotated(angle,x,y,z)

The float version is

glRotatef(angle, x, y, z)

The angle must be in degrees, so convert it to degrees first if it is in radians.

Upvotes: 3

Firas Assaad
Firas Assaad

Reputation: 25750

If the axis is defined by the variables x, y, z, and the rotation angle is in the variable angle, then it's as simple as glRotatef(angle, x, y, z)

Upvotes: 3

Related Questions