Camera Mouse Movement - OpenGL, Allegro 5

Hey everyone; currently I'm programming a first person game using Allegro 5 and OpenGL. Right now, I'm doing mouse movement basically by checking the mouse position on the screen, if it is changed I move the camera over by how much the mouse moved. I've seen some tutorials that use some more complicated methods (I'm still a noob with 3D, so I used this method) but unfortunately they were a bit difficult to understand so I resorted to the simpler method of which I spoke of.

I have a few problems with this method, unfortunately.

For one, it seems the mouse movement isn't "smooth" enough. In some FPS games when you move the mouse it is incredibly smooth, reaching every possible angle. In mine, however, if you move the mouse one pixel, on a platform a bit further away from you will move 3/4 pixels.

Another problem I'm having is when I enter fullscreen.

The mouse is just... incredibly messed up. The camera moves around without me touching the mouse, and I can't control the mouse well at all.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    //mouse movement code
    bool reset = false;
    if(!rolling) { //this is for a "parkour" roll, pay no attention to this if
        if(mouseX != SCREEN_W / 2) {
            horizontalRotation -= (mouseX - (SCREEN_W / 2)) / 3;
            reset = true;      
        }
        if(mouseY != SCREEN_H / 2) {
            verticalRotation -= (mouseY - (SCREEN_H / 2)) / 3;       
            reset = true;
        }     
    
        if(verticalRotation < -90)
            verticalRotation = -90;
        else if(verticalRotation > 90)
            verticalRotation = 90;
    }
    else
        reset = true;
    
    if(reset) {
        al_set_mouse_xy(display, SCREEN_W / 2, SCREEN_H / 2); 
        mouseX = SCREEN_W / 2; 
        mouseY = SCREEN_H / 2;
    }


Please let me know if there is any other code you need to see to help me out.

Thanks in advance!
Topic archived. No new replies allowed.