Web design course - OpenGL Super Bible! Page 359 glNormal Purpose Defines

OpenGL Super Bible! Page 359 glNormal Purpose Defines a surface normal for the next vertex or set of vertices specified. Include File Variations void glNormal3b(GLbyte nx, GLbyte ny, GLbyte nz); void glNormal3d(GLdouble nx, GLdouble ny, GLdouble nz); void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz); void glNormal3i(GLint nx, GLint ny, GLint nz); void glNormal3s(GLshort nx, GLshort ny, GLshort nz); void glNormal3bv(const GLbyte *v); void glNormal3dv(const GLdouble *v); void glNormal3fv(const GLfloat *v); void glNormal3iv(const GLint *v); void glNormal3sv(const GLshort *v); Description The normal vector specifies which direction is up and perpendicular to the surface of the polygon. This is used for lighting and shading calculations. Specifying a unit vector of length 1 will improve rendering speed. OpenGL will automatically convert your normals to unit normals if you enable this with glEnable(GL_NORMALIZE); Parameters nx Specifies the x magnitude of the normal vector. ny Specifies the y magnitude of the normal vector. nz Specifies the z magnitude of the normal vector. Specifies an array of three elements containing the x, y, and z magnitudes of the normal vector. Returns None. Example The following code from the LITJET sample program from this chapter demonstrates setting a normal vector for each polygon before it is rendered. // Vertices for this panel float normal[3];
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.

Leave a Reply