Wednesday, 15 February 2012

OpenGL: objects with color are displayed as black or white

When displaying with OpenGL, if the normals are not normalized, the objects may become black if the normals are too small and white if the normals are too big.

two constants affects normalization

GL_NORMALIZE: normalize normals. it is slower

GL_RESCALE_NORMAL: only scale normals based on scaling factor in modelview matrix. faster than GL_NORMALIZE. If the normals are not normalized from beginning, this won't fix them.

No comments:

Post a Comment