Original Post
Hello:
I can create a positional light that illuminate two spheres, the position of the light is shown by a wireframe sphere. using the following code:
glLoadIdentity();
GLfloat posicion[]={x,y,z,1.0};
glLightfv(GL_LIGHT0,GL_POSITION,posicion);
glEnable(GL_LIGHT0);
glTranslatef(x,y,z);
glutWireSphere(0.1,6,6);
glLoadIdentity();
glTranslatef(-2.0f,0.0f,-5.0);
glutSolidSphere(1.0,32.0,32.0);
glLoadIdentity();
glTranslatef(2.0f,0.0f,-5.0);
glutSolidSphere(1.0,32.0,32.0);
Now my questions are, How do I modify it to be a directional light. For example a light that ilumminates from right to left. Let''s say that the light position will be at (10.0,0.0,-5.0) and it is pointing to (0.0,0.0,-5.0)
And then how I tranform it to a spot light? with an apperture of 30 degrees?
Does anyone knows of a good OpenGL light tutorial? I tried the one at Nehe, but didn''t got all the concepts.
Thank you,
Nicosio