1. ## 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),

2. ## Re: glRotatef()

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].

3. ## Re: glRotatef()

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);

4. ## Re: glRotatef()

Do something like this:
void Render()
{

glClear(GL_COLOR_BUFFER_BIT);
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();
}

5. ## Re: glRotatef()

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

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•