I’m having odd problems with glColorMaterial. I used to have it able to work right, but now it seems to fail all the time and I can’t work out why.
Either all the colors on the scene show up wrong (as the first color drawn), or no colors show up, and everything is white or textured normally.
I use this peusdo-code
DrawTexturedObjects();
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
DrawColoredNonTexturedObject();
DrawNextColoredNonTexturedObject();
glDisable(GL_COLOR_MATERIAL);
Now what happens, is that I get the whole scene blue, which is the only color drawn in DrawColoredNonTextureObject. It seems that although I’m disabling gl color material, its still affecting things.
If I add glcolor4f(1.0, 1.0, 1.0, 1.0); before glDisable gl color material, then I get the whole scene white, and no colors drawn!
I’m stuck here, this is making no sense at all, any idea anyone?