Materials & Light behave differently on different machines

Hi,

I have a difficult problem with my 3D application, especially since I have little knowledge of how lighting and materials really work.

I am drawing several scaled cubes on screen. LIGHT0 is activated, with default properties. For the cubes material I use :

float color2[] = {1.0f, 1.0f, 1.0f, 0.90f};
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color2);

The problem is that the cubes seem to have different colors depending on the machine. On two windows machines with ATI X700 graphic cards, the cubes appear really white. However, on linux machines with nvidia cards at university, on a windows machine with an intel integrated card, and on another windows machine equipped with a nvidia, the pure white color is shown… gray.

Light and depth test are enabled, but not blending or anything else.
I suppose the problem is related to the cards’ drivers, maybe affecting default parameters for light or materials ? However I do not want to say “update your drivers if you want this to work”, since I believe that even 5 years ago, lights and texturing should have been working just as well as now. Maybe it’s just the parameters of my lights or materials.

I know it’s not easy to figure out what the problem is without seeing it, but I would really appreciate some help :slight_smile:

Thanks,
Michael

PS : I forgot to say that the cubes were drawn with GLUT, so normals are set. A similar cube displayed without glut had the same color problem, so GLUT can’t be at fault.

are you using glScale for the scaling ? If so you might want to call glEnable(GL_NORMALIZE) and see if that fixes the lighting issues.

GL_NORMALIZE was enabled as well, though I didn’t think the length of normals could affect lighting (isn’t direction the only important factor ?). I forgot to mention it, sorry :slight_smile:

I just managed to shorten the difference of colors between the two sets of machines.
I think the problem comes from how light is calculated… Changing the direction of light0 to (0,0.3,1) instead of the default (0,0,1) gives a better visual.

With default direction, on incriminated machines the cubes were almost the same color as the background, which was set to (0.7, 0.7, 0.7), instead of a pure white on my computer.

Now the cubes can be seen much whiter on both sort of machine, and that will be enougth for my needs, though it’s not perfect.

Yet there’s still a difference in how light is calculated on the two sets of machines. I’m just curious as for why :slight_smile:

Originally posted by <Michael Roche>:
I suppose the problem is related to the cards’ drivers, maybe affecting default parameters for light or materials ? However I do not want to say “update your drivers if you want this to work”,
Try to specify all material and light parameters instead of relying on the defaults. If the problem really is in incorrect default values, this can fix it without having to update the drivers.

I second Komat about default values.
It may be related to specularity, differences in local viewer mode (glLightModel*).

Check for pitfalls 1, 2, maybe 14 about specular :
http://www.opengl.org/resources/features/KilgardTechniques/oglpitfall/

Can you post a link to the code ?