glRotatef()

when i use the following to rotate it works:
glRotatef(45.0, 0.0, 0.0, 1.0);

however, when i rotate in any of the other axies, nothing. ie the following doesn’t do anything:
glRotatef(0.0, 0.0, 45.0, 1.0),

Originally posted by simmosn:
however, when i rotate in any of the other axies, nothing. ie the following doesn’t do anything:
glRotatef(0.0, 0.0, 45.0, 1.0),

The first argument specifies how many degree you want to rotate around an axis. The following three argument specifiy the x, y, z axis to rotate, respectively. In that statement, you’re rotating the y and z axis 0 degrees. Thats why you don’t see any change. Also, the last three parameters are clamped to the range of [0, 1].

your error is this i think :

glRotatef(angle,x,y,z);

the first parameter is the angle, the others are the axis on wich you want to rotate.

if u want to rotate set the axis to 1.0

//rotate 45 on x axis
glRotatef(45.0, 1.0, 0.0, 0.0);

//rotate 45 on y axis
glRotatef(45.0, 0.0, 1.0, 0.0);

//rotate 45 on z axis
glRotatef(45.0, 0.0, 0.0, 1.0);

Do something like this:
void Render()
{

glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
static float angle; // initializes angle to 0.0f

glRotatef(angle, 0.0f, 1.0f, 1.0f); // Rotate around the y and z axis.

glTranslatef(0.0f, 0.0f, -100.0f);

DrawSomeCube();

angle++;

if(angle >= 360.0f)
angle = 0.0f;

glFlush();
}

thanks for your help. i was being a bit thick, but all part of the learning process

Hello,
I need to rotate in y axis from +15 degree to -15 degree
how to do that
gl.glRotatef(mAngleY, 0, 1, 0);