954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

C OpenGL looking around with mouse.

In my program you should be able to look around smoothly with the mouse, my code works, but I'm wondering if there is any better, smoother way of doing this.
My code to get the mouse position as if the center of the window was 0,0 (LookAround() is the passive motion callback):

void LookAround(int MGx, int MGy){
	if (pause != 1){
	Mx = MGx - (glutGet(GLUT_WINDOW_WIDTH)/2);
	My = MGy - (glutGet(GLUT_WINDOW_HEIGHT)/2);
	glutPostRedisplay();
	}
}

My code to implement this into the gluLookAt function.

gluLookAt(Ex, 0.0, Ez, Mx, My, 5.0, 0.0, 1.0, 0.0);

thanks in advance
(written in C).

YourGamerMom
Newbie Poster
13 posts since Nov 2011
Reputation Points: 6
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You