Purple Specular Lighting?!

Hi, I have a serious problem with specular lighting. It turns purple on most machines, and on some green. Anyone had this problem, I cant seem to get rid of it. It does not turn into the color of a texture on any object, just PURPLE. Its driving me utterly mad.

I use glColorMaterial and glColor on each vertex. Does that make a difference, and I do not set any color to purple.

Please help anyone.

Im a newbie on opengl lighting, but try setting the specular color for the light and material (with glLight and glMaterial).

Although I think the default setting is white, atleast for the first light.

be careful of how you are setting the material properties for the surface.

enabling glColorMaterial will take over one of the material properties specified with the constants : GL_AMBIENT , GL_DIFFUSE , GL_SPECULAR & GL_EMISSION. Whenever you call glColor*() it will apply that colour as the material property of the verticies for which it affects.

This does have a couple of uses, for example you could apply seperate grey-scales to various verticies and use it to create fake shadows.

If you want all of your surface to have the same material properties, then I’d suggest not using glColorMaterial.

instead create some material property colour values:

GLfloat ambient[] = { 0.3 , 0.3 , 0.3 , 0.0 };
GLfloat diffuse[] = { 0.6 , 0.6 , 0.6 , 0.6 };
GLfloat specular[] = { 1.0 , 1.0 , 1.0 , 1.0 };

and when drawing use something like :

glPushMatrix();
glMaterialfv( GL_FRONT , GL_AMBIENT , ambient );
glMaterialfv( GL_FRONT , GL_DIFFUSE , diffuse );
glMaterialfv( GL_FRONT , GL_SPECULAR , specular );
drawObject();
glPopMatrix();

You could also compile a set of glMaterial*() calls as a display list. That way you could create a simple material library, and call the display list before drawing the object. Hope that’s of some use.

[This message has been edited by Rob The Bloke (edited 01-22-2001).]

Originally posted by julius:
[b]Hi, I have a serious problem with specular lighting. It turns purple on most machines, and on some green. Anyone had this problem, I cant seem to get rid of it. It does not turn into the color of a texture on any object, just PURPLE. Its driving me utterly mad.

I use glColorMaterial and glColor on each vertex. Does that make a difference, and I do not set any color to purple.

Please help anyone.

[/b]

I had a similar problem and i solved it disabling the color material like this:

glDisable (GL_COLOR_MATERIAL), but it affected to all the lighted surfaces (not onlu with specular light).