[Solved] Shining and specular lighting

Started by
2 comments, last by Roming22 20 years, 4 months ago
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]
Advertisement
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.
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
I needed the last glext.h file, found on the site web of SGI.

This topic is closed to new replies.

Advertisement