im having trouble understanding how to use OpenGL rotations to simulate an MMORPG camera.I want my program to rotate the camera on 2 axes(x and y) when i press right click and i move the mouse.The diference of mouse coordinates beetwen when i press right click and where i am right now should give me 2 numbers x and y.Those numbers i will use to rotate the world around my character.
I first check if the mouse right click is pressed,then redo the last rotation and do the current rotation.But when it combines the 2 rotations i get rotations on the z axis.
I checked to see if the rotations work fine when they are just one and they do.
I tried:
a)using 2 separate glRotatef calls for each axis;
if(mouseRight==true)
{
glRotatef(-deltaMouse.x*mouseSensitivity,0,1,0);
glRotatef(-deltaMouse.y*mouseSensitivity,0,0,1);
mouse=sf::Mouse::getPosition();
deltaMouse=initialMouse-mouse;
glRotatef( deltaMouse.x*mouseSensitivity,0,1,0);
glRotatef( deltaMouse.y*mouseSensitivity,0,0,1);
}
So my questions are: 1)how do i combine 2 rotations to simulate an MMORPG camera 2)would it be better if i would make my own functions to replace glRotatef and glTranslatef but instead of using matrixes i just add some numbers to the vertex coordinates when i want to draw them?