Materials Vs Color

HI all,
I am writting an exporter that reads
in the data exported from a 3d gfx package.
The ambient , diffuse, specular info
is read in , and I want to use it for the non
textured objects. However, I have been using glMaterialfv to set these values, but the object still appears as grey, even when I use a light…
What is the best way to set these color values ?? SHould I be using COlorMaterial instead or has anyone any suggestions ?
Thanks in advance…
D.

You are on the right way : use glMaterial along with some light(s)…

You must be doing something wrong either with glMaterial either (and more probably) with setting your lights.

Could you tell us more on how you are trying to use the values you read in your file ?

And by the way, disable GL_COLOR_MATERIAL before rendering (just in case !).

Regards.

Eric

thanks for this reply…
basically I am trying to make the object
appear as the same color that it appears
in Maya (which I am using to create the scene). Perhaps my light is not being
set up correctly as you say (is it possible my objects are falling outside the scope of the lights that I am setting?).is there a way of lighting the whole scene or something?
The problem is maya and max always give you
nice default lights and everything is always
illuminated nicely…
Thanks
D.

You can create the Max “default” lights : create two omni lights, one being at (-10000,10000,10000) and another at (10000,-10000,-10000) which means they are far and opposite from (0,0,0). I do not know how Max exactly sets its default lighting but I found this was a good approach.

Meanwhile, I am not totally convinced that your problem lies in the lights…

Regards.

Eric

Be careful : if you enable GL_COLOR_MATERIAL, you must set the material colors wtih glColorMaterial() and glColor() instead of glMaterial(). Maybe it is enabled and you still try to set colors with glColorMaterial()…

Hi.
I’m afraid that you were correct, I did
indeed have glEnable (GL_COLOR_MATERIAL)
enabled in an earlier part of the code.
Many thanks for this. It is working fine. Thanks also for this lighting
tip…
Regards,
Donncha