Archived

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

[Solved] Shining and specular lighting

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

Hi, I have a red sphere that have a the highest specularity possible. But it doesn't make the ball "shine". The trouble is that the light is white and the specular spot appears red. So I think I've guessed the problem: the results of the lighing calculs are multiplied to the color of the texture, but in the case of the specularity I want it to be added. Can anyone tell me if I'am correct, and how to solve the problem? Thanks, Roming22 [edited by - Roming22 on December 11, 2003 8:16:26 AM]

Share this post


Link to post
Share on other sites
The specular colour is calculated together with the ambient, diffuse, and emissive terms, which means it''s calculated before texturing. This might make the specular light look "muted", or different.

But you can make OpenGL calculate it after it applies the texture by changing the light model:

glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);

To restore the default, where specular is calculated with the rest of the lighting:

glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);

This will give better specular highlights.

Share this post


Link to post
Share on other sites
OK, I had found the function, but I thought it was deprecated, as I got an error when compiling:

error C2065: ''GL_LIGHT_MODEL_COLOR_CONTROL'' : undeclared identifier
error C2065: ''GL_SEPARATE_SPECULAR_COLOR'' : undeclared identifier

I don''t have any error for the other openGL calls, so what''s the problem? Do I need a newer version of openGL? Could you post a link to it if the case?

Thanks for your help,

Roming22

Share this post


Link to post
Share on other sites