opengl - Good Practices for updating camera matrix -


i'm learning opengl right now, how move camera. if wish change camera matrix, example, if user translating wasd, there 2 primary ways this:

  1. pre-multiply camera matrix new translation matrix.
  2. manage set of attributes camera, such position, viewing angle, up-vector, modify those, , re-compute camera matrix these.

which of these considered better? feel first introduce drift, , second require more computation, don't know enough analyze two.

one of easiest way model camera use 'lookat' system. remember camera_pos, camera_target, optionally camera_up vectors. build final matrix using old glulookat or modern way glm::lookat.

that way easier model camera , parameters.

here links:

do not @ performance cost. first learn something, build it... optimize if needed.


Comments