KrisPL
12-17-2010, 10:25 AM
Hello! I'm quite new to OpenGL. I think some basics I've already mastered, however gluLookAt still gives me some problems. I'm writing in C++ and my problem is to move the camera left right on flat surface (like in any fps game, where you strafe left or right).
I already found solution for moving forwards and backward on flat surface. It is something like this:
void moveCam(int i){
x = x+i*(lx)*0.2;
z = z+i*(lz)*0.2;
glLoadIdentity();
gluLookAt(x,y,z,x+lx,y+ly,z+lz,0.0f,1.0f,0.0f);
}
Where i is change in movement.
I tried to modify this in any reasonable way I could think of to obtain effect I desire, however with no results.
Can someone help me?
I already found solution for moving forwards and backward on flat surface. It is something like this:
void moveCam(int i){
x = x+i*(lx)*0.2;
z = z+i*(lz)*0.2;
glLoadIdentity();
gluLookAt(x,y,z,x+lx,y+ly,z+lz,0.0f,1.0f,0.0f);
}
Where i is change in movement.
I tried to modify this in any reasonable way I could think of to obtain effect I desire, however with no results.
Can someone help me?