Jump to content
  • Advertisement
Sign in to follow this  

Simple, wierd lighting problem

This topic is 5151 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

Hey all, ive been working on this terrain editor, and i tryed to add a light to the scene, and for some reason it looks like a spotlight, ive worked with lights before, and they worked fine, ive tryed both diffuse and ambient, which, to my understanding should equally light everything in the world, so how come it appears to look like a spotlight?
	float	Direction[]={0.0, 1.0, 1.0, 1.0};
	float	Color[]=	{1.0, 1.0, 1.0};
	glLightfv(GL_LIGHT0, GL_POSITION, Direction);
	glLightfv(GL_LIGHT0, GL_AMBIENT, Color);

Share this post

Link to post
Share on other sites
I can think of a few cases:

- you're not specifying the spot cut-off to be 180 (for an OMNI light)
- you have a range for the light, which happens to fall off where the mesh goes dark
- you're using another light than you think you're using

However, the most likely causes of problems are:

1) your light position should have the 0 _LAST_ if you want it to be directional
2) your color needs four values, else the last value of the light color (RGBA) will be whatever random gunk is on the stack following your array

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

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!