Another rotation instead of glRotate ???

HI
I’m tryng to do a function that does exactly what glRotatef does.

Well, could you people check it, to see what’s wrong?

Shouldn’t this routines rotate the point in the x axis by 90 degrees, just like
glRotatef(90,1.0,0.0,0.0) ??
x1 = x;
y1 = (ycos(90))+(zsin(90));
z1 = (ycos(90))-(xsin(90));

convert your degrees to radians.

radians = (degrees / 360) * 2pi
= (degrees / 180) * pi

[This message has been edited by Attic Man (edited 08-04-2000).]

No, because you use x in the calculation of z.

Also, cos(90) == 0 and sin(90) == 1 (if you use degrees) but something completely different if you use radians (which your computer is doing).

Ok, i’v added the radians conversion, but still not working…,
any sugestions, please?

float Rad(float angle)
{
float PI = 3.14159265;
angle = (angle /180)*PI;
return angle;
}

x1 = x;
y1 = (ycos(Rad(90)))+(zsin(Rad(90)));
z1 = (ycos(Rad(90)))-(xsin(Rad(90)));

thanks
Bruno

In your z1 line, change the x to a z and then swap the positions of the z and y in that line too. At some point you might want to make that Rad function either an inline function or a macro, at least I would anyway.