PDA

View Full Version : question about gluLookAt...



tornado
10-27-2000, 04:17 AM
I want my camera to put on the shoulder.
Why doesn't this source working?

source

glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glTranslatef(5., 0., 5.);
//stand

glPushMatrix();
glScalef(5.0f, 1.f, 5.f);
glutSolidCube(1.);
glPopMatrix();

gluLookAt(0.0f,0.0f,0.0f,-(float)cos(shoulderAngle),0.0f,-(float)sin(shoulderAngle),0.0f,1.0f,0.0f);

glRotatef(shoulderAngle, 0.0, 1.0, 0.0);
glTranslatef(0., 4., 0.);

//shoulder
glPushMatrix();
glScalef(3.f, 8.f, 5.f);
glutSolidCube(1.);
glPopMatrix();

DPalomo
10-27-2000, 04:23 AM
> glMatrixMode(GL_MODELVIEW);
> glPushMatrix();
> glTranslatef(5., 0., 5.);
> //stand

is this on top of your redraw function?
If it is you should
a. glLoadIdentity() of the Modelview matrix
or
b. push your matrix
before the glTranslatef().

Else it will translate every frame the program redraws.

Hope this helps,

Daniel Palomo van Es.