How to specify material properties in arrays?

I guess this is more of an opengl question, but I’ll still ask…

I see glVertexPointer, glNormalPointer, glColorPointer, … Is there one for material colors for ambient/diffuse, etc… Do I use glColorMaterial(ambient/diffuse) in conjunction w/ glColorPointer? What if I wanted to specify ambient/diffuse & specular - each a different color - for each vertex. Any advice appreciated?

Regards,

Monty

If you use shaders you can use the generic glVertexAttribPointer to transfer anything you want to your GPU (on a per vertex basis)(for example your material properties).

Regards,
Fancy

glColorPointer can be used to specify a per-vertex color for the geometry. The glColorMaterial() is a function that then lets opengl interpret the vertex color as a material color of some type (diffuse, ambient, specular, etc.). The other way to do it is to use the glMaterial command. This basically takes a type parameter (as above) and a color argument. The only downside to this method is that it’s uses the same material color for an entire draw command.

glColorPointer is deprecated i guess and doesnt give much manipulation ability. I recomend using the glVertexAttribPointer comand with shaders.