Archived

This topic is now archived and is closed to further replies.

Krippy2k

OpenGL Lighting woes

Recommended Posts

Hi all I was wondering if anybody might be able to explain to me or point me to a resource that explains the way all of the OpenGL lighting functions work in laymans terms. The OpenGL specification only gives you mathematical formula for how it does what it does and it''s too much for the old noodle to handle. lol I thought I understood it but apparently not quite. Let''s say I have a light at 0, 23.75, 0. My ceiling is at 24.0 so this is in the middle of the room right below the ceiling. I set my spot direction to 0, -1, 0 I set my spot cutoff at 45 Now it looks like it is trying to work the way I expect it to kinda. It will light the objects on the left and right all the way to the ground and it looks like pretty close to a 45 degree cutoff. But it will not shed ANY light on the floor which is directly below the light. Here is a screenshot of what I am getting: Click Me Any help or guidance would be awesome Seeya Krippy

Share this post


Link to post
Share on other sites
when you set the light position it''s really 4 varibles.

{x,y,z,0} makes a directional light, ie {0,-1,0,0} makes a light that shines straight down.
{x,y,z,1} makes a light that shines in all directions from a point, ie {0,0,0,1} puts a light on the origin.

When you set the light''s position, it''s multiplyed by the current model matrix, so you should set it after you have everything rotated and moved to where you want, but before they are actually drawn.

Then as long as your normals are right, there should be no problem.

You need to enable something and use some function called colormaterial something if you want to use the glColor command with lights.

Share this post


Link to post
Share on other sites