'gluLookAt()'에 해당되는 글 1건

  1. 2011.10.02 gluLookAt() 의 기본값
Programming/openGL2011.10.02 23:31
수식을 보고 초기값을 찾으려고 하지만.. 영 보이지 않고
Description

gluLookAt creates a viewing matrix derived from an eye point, a reference point indicating the center of the scene, and an UP vector.

The matrix maps the reference point to the negative z axis and the eye point to the origin. When a typical projection matrix is used, the center of the scene therefore maps to the center of the viewport. Similarly, the direction described by the UP vector projected onto the viewing plane is mapped to the positive y axis so that it points upward in the viewport. The UP vector must not be parallel to the line of sight from the eye point to the reference point.

Let

F = ( centerX - eyeX centerY - eyeY centerZ - eyeZ )
Let UP be the vector ( upX upY upZ ) .

Then normalize as follows:

f = F | | F | |
UP ' = UP | | UP | |
Finally, let s = f × UP ' , and u = s × f .

M is then constructed as follows:

M = ( s [ 0 ] s [ 1 ] s [ 2 ] 0 u [ 0 ] u [ 1 ] u [ 2 ] 0 -f [ 0 ] -f [ 1 ] -f [ 2 ] 0 0 0 0 1 )
and gluLookAt is equivalent to glMultMatrixf(M); glTranslated (-eyex, -eyey, -eyez);
 
[링크 : http://pyopengl.sourceforge.net/documentation/manual/gluLookAt.3G.html]
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/gluLookAt.xml]  

If gluLookAt() was not called, the camera has a default position and orientation. By default, the camera is situated at the origin, points down the negative z-axis, and has an up-vector of (0, 1, 0). So in Example 3-1, the overall effect is that gluLookAt() moves the camera 5 units along the z-axis. (See "Viewing and Modeling Transformations" for more information about viewing transformations.)

[링크 : http://glprogramming.com/red/chapter03.html

테스트를 통해서 값을 구해보니
gluLookAt(0.0, 0.0, 0.0,
               0.0, 0.0, -n,
               0.0, 1.0, 0.0) ;
으로 설정을 하면 어떤 n 값(negative z-axis) 이던 동일하게 행렬값이 나온다.
신고

'Programming > openGL' 카테고리의 다른 글

openGL Line 관련설정  (0) 2011.10.06
glutTimerFunc()  (0) 2011.10.05
gluLookAt() 의 기본값  (0) 2011.10.02
GLUT 키보드 콜백 함수 총정....리?  (2) 2011.10.02
GLUI  (0) 2011.09.30
glEnable() / glDisable()  (0) 2011.09.30
Posted by 구차니

댓글을 달아 주세요