PDA

View Full Version : FPS Camera in OpenGL and glm



charisma_tubagus
02-16-2014, 06:24 PM
I read tutorial 6 in opengl-tutorial.org. Here's the link.

http://www.opengl-tutorial.org/beginners-tutorials/tutorial-6-keyboard-and-mouse/

But I don't understand with this part:


horizontalAngle += mouseSpeed * deltaTime * float(1024/2 - xpos );
verticalAngle += mouseSpeed * deltaTime * float( 768/2 - ypos );


Why is the vector becomes an increment of horizontal and vertical angle???

Dark Photon
02-16-2014, 06:55 PM
Kinda looks like they're trying to implement a virtual trackball. That is, where horizontal mouse motion modifies a horizontal rotation angle and vertical mouse motion modifies a vertical rotation angle.

charisma_tubagus
02-16-2014, 07:00 PM
Yes but why the the delta of x becomes an increment of horizontal angle and delta of y becomes an increment of vertical???

Do you have virtual trackball tutorial (theory) link???

tonyo_au
02-17-2014, 12:33 AM
Try looking under "arcball"