Jump to content
  • Advertisement

Archived

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

Maxwan

gl_lighting & glcolor3f

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

Just a simpel question. Is it possible to use gl_lighting and glcolor3f at the same time. I would like to have my quads in a specific color and then change the light, but, when I enable the gl_lighting all the colors turns to white.. I use a ambient ligth to light the whole world.

Share this post


Link to post
Share on other sites
Advertisement
Thanks for the help. However, I didnt understand it all and need some more help now. My code looks like this:

glEnable(GL_LIGHTING);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
glLightfv(GL_LIGHT1, GL_AMBIENT, ambient_light);
glEnable(GL_LIGHT1);

Okey, I have a landshape with colored ground. In a function ambient_light is lowered.
I would like this code to fade everything from their first color into black... But it dosent work the way I would like it to do. I looks more like the glcolor3f values is changing.. aaagh, it''s hard to explain, but it dosent work the way I would like it to work, thats for sure. If I disable the GL_COLOR_MATERIAL the fading-effect works the way I would like it to, but then ofcourse, no colors. I hope this makes sense and someone can help me =)

Share this post


Link to post
Share on other sites
Try
glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);

Make sure you set the current material's ambient and specular colour to black too.

float black[4]={0,0,0,0};
glMaterialfv(GL_FRONT,GL_AMBIENT,black);
glMaterialfv(GL_FRONT,GL_SPECULAR,black);

[edited by - benjamin bunny on May 5, 2003 6:29:15 PM]

Share this post


Link to post
Share on other sites

  • 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!