glRotatef problem

Started by
11 comments, last by MARS_999 15 years, 8 months ago
Hi All I'm wanting to rotate a quad around the Y-axis which I have got it to do, but it rotates the wrong side of the quad. Is there anyway I can get it to rotate the other side of my quad? Thank you in advance. Andrew
Advertisement
What do you mean it rotates the wrong side? I need a bit more info on what is wrong or you want the rotation to do.
Well the quad I have rotating rotates from the left side of the quad. It seems to do this with all the quads i've created by default. What I'm wanting to know is how would I rotate a quad from the right hand side? :)
flip your sign value... if you are +100 try -100....
what is a sign value? could u explain further please?

Thank you.
uhmmm...mathematically speaking, a sign is what you use to distinguish between positive and negative values, e.g. +100 and -100, where + and - are signs.

Rotations can be either clockwise or counterclockwise (which I assume is what you mean by saying that your quad rotates from the left or from the right side).

So if you are using glRotate, try using a negative value for the rotation amount instead of a positive value to make your quad rotate in the opposite direction
Ah I get you now, yes I'll try that, thank you.

so basically,

instead of glRotatef(angleValue, 0.0f, 1.0f, 0.0f)

it would be:

glRotatef(-angleValue, 0.0f, 1.0f, 0.0f)

Andrew
Exactly :)
Whoaaaaaaa
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Hi

I'm afraid it does not work by just changing the sign, any other ideas? :)

This topic is closed to new replies.

Advertisement