lighting - OpenGL: What happens if I specify a light as both specular and diffuse? -


on sphere lighting example of redbook read this:

glfloat light_ambient[] = { 0.0, 0.0, 0.0, 1.0 }; glfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; glfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 }; glfloat light_position[] = { 1.0, 1.0, 1.0, 0.0 };  gllightfv(gl_light0, gl_ambient, light_ambient); gllightfv(gl_light0, gl_diffuse, light_diffuse); gllightfv(gl_light0, gl_specular, light_specular); gllightfv(gl_light0, gl_position, light_position); 

then says:

in example, first 3 calls gllightfv() superfluous, since they’re being used specify default values gl_ambient, gl_diffuse, , gl_specular parameter

as understand far, every light source has default values ambient, diffuse , specular parameters , these 3 arrays specify default values, is right? does every light source default diffuse, specular , ambient?

in opengl lighting model, 4 separate lighting equations computed object: ambient, diffuse, specular, , emission. ambient doesn't take normals account, diffuse , specular do, , emission doesn't take light account @ all.

all these different lighting values summed give final color of object.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -