I have this code below. Notice at the bottom the last line is the warp pointer function. This moves the mouse where you want it. The function as a whole moves a fps camera around like in a fps game. The only thing is that when i reach the edge of my screen and the mouse moves out of the program, it stops rotating around. I tried to center the cursor to the screen with warppointer but then it stays stuck when you try to rotate the view around. I kinda see why...but I was wondering if there was some code someone could give to solve my problem or modify this to work.
bool firstMouse = true;
GLfloat yaw = -90.0f;
GLfloat pitch = 0.0f;
GLfloat lastx = 800.0f / 2.0f;
GLfloat lasty = 600.0f / 2.0f;
...
void MyGLCanvas::onMouseMove(wxMouseEvent& event)
{
if (firstMouse)
{
lastx = event.GetX();
lasty = event.GetY();
firstMouse = false;
}
GLfloat offsetx = event.GetX() - lastx;
GLfloat offsety = lasty - event.GetY();
lastx = event.GetX();
lasty = event.GetY();
GLfloat sens = 0.1f;
offsetx *= sens;
offsety *= sens;
yaw += offsetx;
pitch += offsety;
if (pitch > 89.0f)
pitch = 89.0f;
if (pitch < -89.0f)
pitch = -89.0f;
glm::vec3 front;
front.x = cos(glm::radians(yaw)) * cos(glm::radians(pitch));
front.y = sin(glm::radians(pitch));
front.z = sin(glm::radians(yaw)) * cos(glm::radians(pitch));
aCam->cameraAt = glm::normalize(front);
parentFrame->WarpPointer(lastx, lasty);
}