How to get specular color in OpenGL?

769 Views Asked by At

My code works for everything except specular component.

glEnable(GL_COLOR_SUM);
...
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, color);
glEnableClientState(GL_SECONDARY_COLOR_ARRAY);
glSecondaryColorPointer(3, GL_UNSIGNED_BYTE, 0, specular);
...
glDrawArrays(D3DPT_TRIANGLELIST, 0, 2);

It seems to ignore specular, but color, texture co-ordinates, positions, and so on are all completely fine.

This is NOT using lights and materials. Fixed-vertex pipeline. Shaders are not an option at this point, unfortunately.

glGetError() reports no errors at any point either.

1

There are 1 best solutions below

3
On

you said:

This is NOT using lights and materials.

specular can only be calculated when there is a light to get it from. (if you want I can go into the math behind it...)

from http://en.wikipedia.org/wiki/Specular_highlight:

A specular highlight is the bright spot of light that appears on shiny objects when illuminated.

on a side note what is D3DPT_TRIANGLELIST doing in OpenGL code? is that just a mistake in the question or does it actually work like that?