Hi,
Ive created 2 sphears and rendering them something like this:
glPushMatrix();
glTranslatef();
glRotate(ang, 1, y, z);
draw sphear
glPopMatrix();
glPushMatrix();
glTranslatef();
glRotate(ang, x, y, 1);
draw sphear
glPopMatrix();
The first sphear rotates ok, (around x)
but the second one rotates around both x and z
Whats causing that?
Doesnt glPushMatrix means to load a clean matrix without any transformation?
(I dont want to use glLoadidentity()
but maybe thats the only way?
Hope not, then i need to relocate whole my world
Thanks guys.
satan
February 14, 2002, 11:56am
2
glpushmatrix pushes the current matrix to the matrix stack (clever name for such a function )
glloadidentity sets the current matrix to identity and is perhaps what you mean by a ‘clean matrix’
[This message has been edited by satan (edited 02-14-2002).]
Ok,
but how do i rotate the sphears without having the first affecting the other?
Without using glLoadIdentity()
tx
system
February 14, 2002, 12:26pm
4
Unless of course, you had left some value for x when you rotate the 2nd sphere
Originally posted by Dies_Irae:
[b]Ok,
but how do i rotate the sphears without having the first affecting the other?
Without using glLoadIdentity()
tx
[/b]
Jambolo
February 14, 2002, 8:43pm
5
Everything appears ok to me except for the x, y, and z variables in the glRotate calls.
If you want to rotate around the X axis, the call should be:
glRotate(ang, 1, 0, 0);
If you want to rotate around the Z axis, the call should be:
glRotate(ang, 0, 0, 1);
I bet you put the x, y, and z values in because of the translations. Don’t do that.
Hey,
Yea sorry its like that, dont know why i typed like that,
glRotate(90, 1, 0, 0)
glRotate(90, 0, 0, 1)
If you Push and Pop matricies around them ,
the 2nd one should not rotate
(x 90 z 90) if thats true there must be something else with my code, time for some serious debuging
Thanks guys. (Or ladies)
Ah crap, just a small mistake
tx.