glGet() 함수 사용법을 익힐겸 해보니 흐음..
일단 아무런 설정없이 openGL 에서 생성해서 해보니 다음과 같은 행렬을 뽑아내준다.
주석을 풀고 변경된 크기로 보면은 다음과 같이 나온다.
gluLookat()에 의해서 MODELVIEW_MATRIX에서 -5가 추가된듯 하고
PROJECTION은 이해불가 ㅋㅋㅋ
[링크 : http://www.morrowland.com/apron/tutorials/gl/gl_matrix.php]
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glGet.xml]
[링크 : http://www.songho.ca/opengl/gl_transform.html]
[링크 : http://www.cprogramming.com/tutorial/3d/rotationMatrices.html]
일단 아무런 설정없이 openGL 에서 생성해서 해보니 다음과 같은 행렬을 뽑아내준다.
GL_MODELVIEW_MATRIX
1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 0.000000 0.000000
0.000000 0.000000 1.000000 0.000000
0.000000 0.000000 0.000000 1.000000
GL_PROJECTION_MATRIX
1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 0.000000 0.000000
0.000000 0.000000 1.000000 0.000000
0.000000 0.000000 0.000000 1.000000 |
주석을 풀고 변경된 크기로 보면은 다음과 같이 나온다.
GL_MODELVIEW_MATRIX
1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 0.000000 0.000000
0.000000 0.000000 1.000000 0.000000
0.000000 0.000000 -5.000000 1.000000
GL_PROJECTION_MATRIX
1.732051 0.000000 0.000000 0.000000
0.000000 1.732051 0.000000 0.000000
0.000000 0.000000 -1.105263 -1.000000
0.000000 0.000000 -2.105263 0.000000
|
gluLookat()에 의해서 MODELVIEW_MATRIX에서 -5가 추가된듯 하고
PROJECTION은 이해불가 ㅋㅋㅋ
void reshape(int w, int h)
{
GLdouble mat[16];
int i=0;
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
/*
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 20.0);
glMatrixMode(GL_MODELVIEW); //GL_PROJECTION
glLoadIdentity();
gluLookAt(0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
*/
printf("GL_MODELVIEW_MATRIX\n");
glGetDoublev(GL_MODELVIEW_MATRIX,mat);
for(i=0; i<16;i++)
{
printf("%f ",mat[i]);
if(i % 4 == 3) printf("\n");
}
printf("GL_PROJECTION_MATRIX\n");
glGetDoublev(GL_PROJECTION_MATRIX,mat);
for(i=0; i<16;i++)
{
printf("%f ",mat[i]);
if(i % 4 == 3) printf("\n");
}
}[링크 : http://www.morrowland.com/apron/tutorials/gl/gl_matrix.php]
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glGet.xml]
[링크 : http://www.songho.ca/opengl/gl_transform.html]
[링크 : http://www.cprogramming.com/tutorial/3d/rotationMatrices.html]
'Programming > openGL' 카테고리의 다른 글
| glEnable() / glDisable() (0) | 2011.09.30 |
|---|---|
| glGet() (0) | 2011.09.30 |
| GLUT keyboard callback function (0) | 2011.09.27 |
| openGL로 싸인곡선 그리기(sin wave) (5) | 2011.09.25 |
| webGL (0) | 2011.09.24 |