i'm learning opengl right now, how move camera. if wish change camera matrix, example, if user translating wasd, there 2 primary ways this:
- pre-multiply camera matrix new translation matrix.
- 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:
- http://www.opengl.org/archives/resources/faq/technical/viewing.htm
- http://www.codeproject.com/articles/84698/opengl-camera
- http://www.songho.ca/opengl/gl_transform.html
do not @ performance cost. first learn something, build it... optimize if needed.
Comments
Post a Comment