Hi!
I using OpenGL w/ SDL.
I’m trying to get my camera with the mouse.
When moving the mouse (on the axis X and Y), the camera makes strange rotations. I’m putting my full code for download (Source + Executable).
http://www.mediafire.com/?vdzjuocjim2
Thanks
Hi!
I have not read your code but I can remember that I had the same problem. My problem was that I had to save the last position in the camera(m_mouseX and m_mouseY). This is my code for handling movement of the mouse. Hope it helps.
104 //////////Rotations whit mouse/////////////
105 void Camera::moveMouse(float width, float height, float x, float y){
106
107 float delta_X = m_mouseX-x;
108 float delta_Y = m_mouseY-y;
109
110 float radX = (delta_X/width);
111 float radY = (delta_Y/height);
112
113 vr::Matrix matrix;
114
115 matrix.makeRotate(-radY, 1,0,0);
116 m_view.mult(m_view,matrix);
117
118 matrix.makeRotate(-radX, 0,1,0);
119 m_view.mult(m_view,matrix);
120
121
122 m_mouseX = x;
123 m_mouseY = y;
124 }