Implementación de gluLookAt: orientación de zAxis
Frecuentes
Visto 507 veces
0
In the gluLookAt function zAxis = target - cameraPosition
and then in a view matrix we put -zAxis
or we can write that zAxis = cameraPosition - target
and then in a view matrix we put zAxis
to get the same result. Why we have to negate zAxis in the first case or change order of operation in the second case ?
1 Respuestas
2
In OpenGL, the standard camera space is a right-handed coordinate system. +X goes to the right, and +Y goes up. Because it's right-handed, +Z goes detrás de the viewer. Thus the viewer is looking along the -Z axis. Hence the negation.
Respondido 25 ago 12, 11:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas math opengl linear-algebra or haz tu propia pregunta.
So, when I don't use the gluLookAt function but I build my own view matrix using a camera position, xAxis, yAxis, zAxis (xAxis.x, xAxis.y, xAxis.z, -dot(xAxis, cameraPos), yAxis.x, yAxis.y, yAxis.z, -dot(yAxis, cameraPos), zAxis.x, zAxis.y, zAxis.z, -dot(zAxis, cameraPos, 0, 0, 0, 1) and then I just rotate those axes in my camera class I should define default xAxis, yAxis and zAxis this way: (1,0,0),(0,1,0),(0,0,1) ? - Irbis