Jump to content
  • Advertisement
Sign in to follow this  

OpenGL Proper lighting

This topic is 4144 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! In my current program I'm having trouble adjusting the light and material properties of some models. The lit models are either too bright or too dark. These "stations" are pretty flat and I guess that makes it harder to have good results without knowing exactly what am I doing. I know some theory about the light components, but hardly anything about OpenGL's way to do these. Some the setting I use:
	float pos[] = {20,80,20,0};
	float amb[] = {0.4f, 0.4f, 0.4f, 1.0f};
	float diff[] = {0.4f, 0.4f, 0.4f, 1.0f};
	float spec[] = {0.1f, 0.1f, 0.1f, 1.0f};
	glLightfv(GL_LIGHT0, GL_POSITION, pos);
	glLightfv(GL_LIGHT0, GL_DIFFUSE, diff);
	glLightfv(GL_LIGHT0, GL_SPECULAR, spec);
	// ...
	glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, somcolour);

">This is how the program looks like now shinjin

Share this post

Link to post
Share on other sites
That's all I set in the one in the video.

Later I tried adding

glMaterialfv(GL_FRONT, GL_SPECULAR, playercolours[cp]);
glMaterialf(GL_FRONT, GL_SHININESS, 10);

with different shininess values, but didn't really changed a thing.

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!