Sign in to follow this  

Simple, wierd lighting problem

This topic is 4841 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);
	glEnable(GL_LIGHT0);

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

This topic is 4841 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this