Cpanel web hosting - OpenGL Super Bible! Page 327 material properties are

OpenGL Super Bible! Page 327 material properties are all you need if you are modeling clay, wood, cardboard, cloth, or some other flatly colored object. But for metallic surfaces like the skin of an airplane, some shine is often necessary. Specular Highlights Specular lighting and material properties add needed gloss to the surface of your objects. This shininess has a whitening effect on an object s color and can produce specular highlights when the angle of incident light is sharp in relation to the viewer. A specular highlight is what occurs when nearly all the light striking the surface of an object is reflected away. The white sparkle on a shiny red ball in the sunlight is good example of a specular highlight. Specular Light Adding a specular component to a light source is very easily done. The following code shows the light source setup for the LITJET program, modified to add a specular component to the light. // Light values and coordinates // Light values and coordinates GLfloat ambientLight[] = { 0.3f, 0.3f, 0.3f, 1.0f }; GLfloat diffuseLight[] = { 0.7f, 0.7f, 0.7f, 1.0f }; GLfloat specular[] = { 1.0f, 1.0f, 1.0f, 1.0f}; Glfloat lightPos[] = { 0.0f, 150.0f, 150.0f, 1.0f }; // Enable lighting glEnable(GL_LIGHTING); // Setup and enable light 0 glLightfv(GL_LIGHT0,GL_AMBIENT,ambientLight); glLightfv(GL_LIGHT0,GL_DIFFUSE,diffuseLight); glLightfv(GL_LIGHT0,GL_SPECULAR,specular); glLightfv(GL_LIGHT0,GL_POSITION,lightPos); glEnable(GL_LIGHT0); The specular[] array specifies a very bright white light source for the specular component of the light. Our purpose here is to model bright sunlight. The line glLightfv(GL_LIGHT0,GL_SPECULAR,specular); simply adds this specular component to the light source GL_LIGHT0. If this were the only change you made to LITJET, you wouldn t see any difference in the jet s appearance. This is because we haven t yet defined any specular reflectance properties for the material properties.
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Leave a Reply