glNormal()은 점이나 면에 대해서 법선 벡터를 정하는 함수이다.
이러한 법선 벡터는 빛의 반사를 계산하는데 쓰이는데 설정하지 않았을 경우 기본값은 (0,0,1)로 지정이 된다.
nomalize는 단위벡터로 입력을 받는 기능인데 기본적으로 꺼져 있으나 과도하게 큰 값이 들어가면
흰색이나 검은색으로 보이기도 하니, 되도록이면 평준화 시켜서 사용하는 것이 좋을듯 하다.
Specify the x, y, and z coordinates of the new current normal.
The initial value of the current normal is the unit vector, (0, 0, 1).
Description
The current normal is set to the given coordinates whenever glNormal is issued. Byte, short, or integer arguments are converted to floating-point format with a linear mapping that maps the most positive representable integer value to 1.0 and the most negative representable integer value to -1.0 .
Normals specified with glNormal need not have unit length. If GL_NORMALIZE is enabled, then normals of any length specified with glNormal are normalized after transformation. If GL_RESCALE_NORMAL is enabled, normals are scaled by a scaling factor derived from the modelview matrix. GL_RESCALE_NORMAL requires that the originally specified normals were of unit length, and that the modelview matrix contain only uniform scales for proper results. To enable and disable normalization, call glEnable and glDisable with either GL_NORMALIZE or GL_RESCALE_NORMAL. Normalization is initially disabled.
If enabled, include light i in the evaluation of the lighting equation. See glLightModel and glLight.
GL_LIGHTING
If enabled and no vertex shader is active, use the current lighting parameters to compute the vertex color or index. Otherwise, simply associate the current color or index with each vertex. See glMaterial, glLightModel, and glLight.
GL_NORMALIZE
If enabled and no vertex shader is active, normal vectors are normalized to unit length after transformation and before lighting. This method is generally less efficient than GL_RESCALE_NORMAL. See glNormal and glNormalPointer.
452 FGAPI void FGAPIENTRY glutChangeToMenuEntry( int item, const char* label, int value );
453 FGAPI void FGAPIENTRY glutChangeToSubMenu( int item, const char* label, int value );
454 FGAPI void FGAPIENTRY glutRemoveMenuItem( int item );
455 FGAPI void FGAPIENTRY glutAttachMenu( int button );
456 FGAPI void FGAPIENTRY glutDetachMenu( int button );
사용예는 아래와 같이
menuid = glutCreateMenu(callback); 로 생성을 하고 콜백함수를 등록하며
생성된 메뉴에 glutAdd*() 함수들을 이용해 항목이나 하위 메뉴를 추가하는 형식으로 구성된다.
submenu의 경우에는 생성이 완료된 하나의 메뉴를 현재의 메뉴 아래에 추가하는 것이기 때문에
예제처럼 하위 메뉴를 먼저 생성하고 메인 메뉴를 생성한뒤 하위 메뉴를 추가해주어야 한다.
OpenGLUT is an open source project to evolve the GLUT (OpenGL Utility Toolkit) C/C++ API. OpenGLUT uses the freeglut code base as a foundation for extending, enhancing and refining the API.
[링크 : http://openglut.sourceforge.net/]
카메라 (gluLookAt) 와 중심점의 거리가 1.0 을 넘어서면 시야에서 사라진다 -_-
이 사태를 해결하려면 어떻게 해야할려나?
웃긴건 카메라보다 뒤쪽으로 가는건 괜찮음..
아무튼 X(red) Y(green) Z(blue) 의 좌표는 (1.0) 으로 했기 땜누에 방향에 문제는 없어 보이고
화면 안쪽으로 -Z 축인건 맞은데 도대체 멀까나...
또한 축은 길이가 1 이지만, sin 곡선은 3.6 인데 중심축과 카메라의 거리가 1 이내에 있을때에는
sin 곡선도 잘리지 않음 -_-
(코드 붙여 넣고 보니.. scale을 1/4로 줘서 그렇군 .. 3.6 길이가 그러면 0.9가 되니 1 안에 들어옴)