I've created this basic 3D Demo using OpenGL/SDL. I handled the keyboard callback so I can "strafe" left and right using 'a' and 's' and move forward and backward using 's' and 'w'.
However, I would like to now make it so I can control the direction my camera is "looking" based off my mouse movements. Just like in a FPS shooter when you move the mouse around it makes the camera look around in various directions.
Does anyone have any idea how I could utilize the mouse callbacks to "points" the camera class correctly when I move the mouse?
#include "SDL.h"
#include "Camera.h"
Camera cam;
Scene scn;
//<<<<<<<<<<<<<<<<<myKeyboard>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void myKeyboard(unsigned char key, int x, int y)
{
  switch(key)
    {
    case 's': cam.slide(0.0, 0.0, 0.2); break;
    case 'w': cam.slide(0.0, 0.0, -0.2); break;
    case 'a': cam.yaw(-1.0); break;
    case 'd': cam.yaw(1.0); break;
    case 27: exit(0);
    }
  glClear(GL_COLOR_BUFFER_BIT);
  glutPostRedisplay();
}
void displaySDL( void )
{
    glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    scn.drawSceneOpenGL();
    glFlush();
    glutSwapBuffers();
}
int main( int argc, char* argv[] )
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(640, 480);
    glutInitWindowPosition(100, 100);
    glutCreateWindow("SDL Sence With Camera");
    glutKeyboardFunc(myKeyboard);
    glutDisplayFunc(displaySDL);
    glShadeModel(GL_SMOOTH);
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_NORMALIZE);
    glViewport(0, 0, 640, 480);
    scn.read("fig5_63.dat");
    glEnable(GL_LIGHTING);
    glEnable(GL_LIGHT0);
    scn.makeLightsOpenGL();
    cam.set(2.3, 1.3, 2.0, 0, 0.25, 0, 0, 1, 0);
    cam.setShape(30.0f, 64.0f/48.0f, 0.5f, 50.0f);
    glutMainLoop();
    return 0;
}
This is a tar with my SDL file, and the file I pasted above and my Camera class. http://www.filedropper.com/fpsdemotar
If someone can give me some tips for what algorithm I should use when processing mouse callbacks in terms of pointing the camera I would appreciate it.
Thanks!