Hi people, I’m new here!
First, I say sorry for my bad english.
Well, I’m new with OpenglGL and I’m developing a little application as a research, using GLUT and Windows.
Going direct to the matter, I want to make a FPS (first person shooter) camera style and I’m using glulookat and biding the mouse “pointer” as the aim - I don’t know if this is the most acceptable option. But anyway, since the coordinates accepted in a Window for the pointer position (x, y) will never be lesser than 0, I can’t figure out on how I could make a 360 degrees camera style using glulookat bounded to mouse, like FPS games.
I.e., when I move the mouse near the left side of the window, the camera moves too, but as the X coordinate go tending to 0, I get to a time where I can’t continue moving the camera to the same side, because there is no more mouse move from 0 to 0.
My code is as follows:
[b]
void MouseMotion(int x,int y)
{
int w, h;
w = glutGet(GLUT_WINDOW_WIDTH);
h = glutGet(GLUT_WINDOW_HEIGHT);
Camera_Mira_X = x - w / 2;
Camera_Mira_Y = -(y - h / 2);
//I divided by 2 because I start the camera at origin, 0,0 and this is the middle of the window size.
}[/b]
My calling to glulookat (please, ignore Camera_Pos variables)
gluLookAt(Camera_Pos_X, 0.0, Camera_Pos_Z, Camera_Mira_X, Camera_Mira_Y, -100, 0.0, 1.0, 0.0);
I thank you very much since now.
Regards,
Guilherme.