Example #1
0
	void Camera::mouse_callback(GLFWwindow* window, double xpos, double ypos)
	{
		if(firstMouse)
		{
			lastX = static_cast<GLfloat>(xpos);
			lastY = static_cast<GLfloat>(ypos);
			firstMouse = false;
		}

		GLfloat xoffset = static_cast<GLfloat>(xpos) - lastX;
		GLfloat yoffset = lastY - static_cast<GLfloat>(ypos);  // Reversed since y-coordinates go from bottom to left

		lastX = static_cast<GLfloat>(xpos);
		lastY = static_cast<GLfloat>(ypos);
		ProcessMouseMovement(xoffset, yoffset);
	}	
Example #2
0
   void OGLSphereCamera::mouse_callback(GLFWwindow* Triangle, double xpos, double ypos)
   {
	   if (firstMouse)
	   {
		   lastX = xpos;
		   lastY = ypos;
		   firstMouse = false;
	   }

	   GLfloat xoffset = xpos - lastX;
	   GLfloat yoffset = lastY - ypos;  // Reversed since y-coordinates go from bottom to left

	   lastX = xpos;
	   lastY = ypos;
	   ProcessMouseMovement(xoffset, yoffset);
   }