glRotatef() - A newbie question... please help

Drawscene()
{
glTranslatef(-1myposx,-1myposy,-1*mypoz);
glPushMatrix();
glRotatef(theta,0,1,0);
drawWorld(); //draws the world
glPopMatrix();
}

should that appear as if I I was standing at myposx, myposy, myposz looking in the theta direction… but that doesn’t happen, instead of that… the whole world moves around the original origin (before glTranslate) instead of after the translate… I can work around this problem with gluLookAt, but it’s not ALWAYS the best solution, I don’t want to neglect glRotatef and glTranslate… could anyone tell me what I am doing wrong?

[b]

Drawscene()
{
//assuming identity is set
glRotatef(theta,0,1,0);
glTranslatef(-myposx,-myposy,-mypoz);
drawWorld(); //draws the world

}

You need to be looking in the correct direction before you translate to your viewing position.

that doesn’t work , when I comment out the glRotatef() nothing changes…

can anyone else give me a hint?

Try this,

Drawscene()
{
glRotatef(theta,0,1,0);
glPushMatrix();
glTranslatef(-1myposx,-1myposy,-1*mypoz);

drawWorld(); //draws the world
glPopMatrix();
}

It seems that what you were originally doing was translating out, then rotating, which would rotate around the origin.

This way rotates at the origin, putting the viewer in the correct position, and then translates to where it should be.

David.