Jump to content
• Advertisement

#### Archived

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

# OpenGL Lighting woes

This topic is 6308 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

## 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

##### Share on other sites
Advertisement
Oh yeah
Here is what the world looks like with standard lighting.

Click Me Too

#### Share this 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

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
frob
20
3. 3
Rutin
17
4. 4
5. 5
• Advertisement

• 13
• 10
• 9
• 18
• 9
• ### Forum Statistics

• Total Topics
632555
• Total Posts
3007035

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!