After reading on the coordinate systems in OpenGL, I figured to move the camera around the world I just need to translate the view coordinates. If I say use view = glm::translate(view, glm::vec3(0, 0, -50));
, I'm translating the camera 50 units back (by translating the world 50 units forward). After thinking I had it figured out, I encounter LookAt function. I can't understand why I would need to use this function, if I just can move around my camera by translating and rotating the view. The whole thing is a bit hard to wrap the head around, so I'm sorry if this doesn't make much sense!
Asked
Active
Viewed 831 times
2

John Smith
- 33
- 5
-
5Who says that you *need to* use it? Your question seems like someone asking why they need to use `std::sort`, since they can implement a quick-sort just fine themselves. And why do you think "I just can move around my camera by translating and rotating the view" is not literally what the function does? – Nicol Bolas Dec 30 '18 at 05:15
-
2Nico is right you do not need to use it if you do not want to ... I code in OpenGL many years and still never used `LookAt` not the GLU nor the GLM version ... in fact I never used GLM (as I got my own math that predates GLM and suite my needs much better) and the only stuff I use from GLU is `gluPerspective` and lately not even that ... The `LookAt` function is usually used by rookies as an shortcut for those they do not understand the matrix math preventing them from simple implementation of advanced camera stuff later on ... – Spektre Dec 30 '18 at 09:04
-
I [totally agree](http://stannum.io/blog/0UaG8R) with you that `lookAt` is overused, and is more often than not can be better expressed by composing rotations and translations. – Yakov Galka Oct 28 '20 at 06:47
1 Answers
0
glm::LookAt
or mat4x4_look_at
of linmath.h or gluLookAt
, and so on, are all just there for your (= the programmer's) convenience. That's all.
If you want to setup the view portion of the modelview transform with a different method, because it suits you better, then by all means you should to that then.

datenwolf
- 159,371
- 13
- 185
- 298