I think I got the answer about the second point(how about the attributes of light) – we can get the attributes from the class SPODLight, normally we access the lights from POD from the array pLight in class CPVRTModelPOD.
The issue which you describe isn’t actually a bug. To specify a directional light in OpenGL you pass in a directional vector with the w component set to 0 to glLightfv with the enum GL_POSITION. As per OpenGL documentation:
"If the w component of the position is 0, the light is treated as a directional source. Diffuse and specular lighting calculations take the light’s direction, but not its actual position, into account, and attenuation is disabled."
If you take a look at the code again you’ll see the line …
vLightDirection.w = 0;
... before the call to glLightfv.
I see now – the codes in SDK are for the directional light(w = 0.0). If we want to setup attributes for other types such as point light or spot light, we have to put the variable “vPos” as the parameter(w = 1.0 to point out that is position vector) for GL_POSITION.
That it exactly right, yes. Point lights need only GL_POSITION to be set (with w component = 1.0) and spot lights require GL_POSITION (with the previous requirements) and GL_SPOT_DIRECTION with a directional vector. Of course spot lights have more parameters too (such as exponent and cutoff) but these are the enums associated with position and direction.