glNormal*()的作用

来源:互联网 发布:淘宝手机助手登陆不了 编辑:程序博客网 时间:2024/04/30 03:34

[OpenGL Redbook p47] Use glNormal*() to set the current normal to the value of the argument passed in. Subsequent calls to glVertex*() cause the specified vertices to be assigned the current normal. Often, each vertex has a different normal, which necessitates a series of alternating calls, as in the example.

Example:Surface Normals at Vertices

glBegin (GL_POLYGON);

glNormal3fv(n0);

glVertex3fv(v0);

glNormal3fv(n1);

glVertex3fv(v1);

glNormal3fv(n2);

glVertex3fv(v2);

glNormal3fv(n3);

glVertex3fv(v3);

glEnd();

 

PSglNormal*() 用来设置当前的法向量,这个法向量将被应用到紧接下来的glVertex*() 所定义的顶点上。但是通常各个顶点的法向是各不相同的,所以我们通常在定义每个顶点之前都为它确定一次法向量。

原创粉丝点击