gl.glRotatef(this.rotate, 0f, 0f, -12.0f);

gl.glRotatef(this.rotate, 0.0f, 0.0f, -12.0f);
Just been trying to get my head around how this method works. After looking at the api I manage to get that the first argument is the angle and the other three are the coordinates of the point you are rotating around? Yeah just been trying to us it and my models have been doing all kinds of cool things just not what i want.

So could someone please please please explain how the glRotate method works? I know this must be a noob question but I’m only just getting my head into the thousands of jogl methods and fields and your help would be greatly appreciated.

Enlighten me!

Cheers,
James

Think seeing this bit of code may of helped… maybe

gl.glRotatef(xrot,1.0f,0.0f,0.0f);
gl.glRotatef(yrot,0.0f,1.0f,0.0f);
gl.glRotatef(zrot,0.0f,0.0f,1.0f);

[quote=“Ru5tyNZ,post:1,topic:31700”]

  • The first argument is the angle of the rotation (in degrees)
  • The others arguments are NOT the point you are rotating around. You always rotate around origine (0.0 , 0.0, 0.0). If you want to rotate around another point, you should use a translation with it.
  • The others arguments are a vector that show how the angle is apply. The rotation is in a perpendicular plan to the vector. And when you look at the vector from the end to the begining, the angle is counter clock wise.

http://jerome.jouvie.free.fr/images/OpenGl/Tutorials/Tutorial4-AxisAngle.png

So like Ru5tyNZ said :

gl.glRotatef(xrot,1.0f,0.0f,0.0f); is a rotation around the X axis
gl.glRotatef(yrot,0.0f,1.0f,0.0f);is a rotation around the Y axis
gl.glRotatef(zrot,0.0f,0.0f,1.0f); is a rotation around the Z axis

Cheers that clears it up perfectly.