Pushing and Popping Material Colour in a Display List

Is there any way I can compile a Display List so that it Pushes and Pops Material Colour?

I have a model of a boat that I want to store completely in a display list. I was hoping to set the colour before calling the display list to draw it (So that I can have boats of many colours), yet at the same time, force the glass to be clear blue, and the lights to be bright red (using GL_EMMISSION). I figured I could use glPushAttrib(GL_CURRENT_BIT) but all the colours went wack after that.

Any suggestions?

If you’re currently doing something like

glPushAttrib(GL_CURRENT_BIT);
draw_solid_parts_of_boat();
glColor4f(0.0f,0.2f,1.0f,0.4f);
draw_windows_of_boat();
glPopAttrib(GL_CURRENT_BIT);

in your display list, I’d say that you are right and your implementation is wrong.

Originally posted by zeckensack:
[b]If you’re currently doing something like[quote]

glPushAttrib(GL_CURRENT_BIT);
draw_solid_parts_of_boat();
glColor4f(0.0f,0.2f,1.0f,0.4f);
draw_windows_of_boat();
glPopAttrib(GL_CURRENT_BIT);

in your display list, I’d say that you are right and your implementation is wrong.[/b][/QUOTE]

Roughly. After initialisation I do

glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);

glNewList(DisplayListID, GL_COMPILE);
DrawHull();
glPushAttrib(GL_CURRENT_BIT);
glColor4fv(Glow);
glMaterialfv(GL_FRONT, GL_EMISSION, Glow);
DrawCockPit();
glPopAttrib();
glEndList();

Then during drawing I would call it.

glColor3fv(tObject->Colour);
glCallList(DisplayListID)

Based on what you said it sounds like I have the right idea. However does ‘wrong implementation’ mean I’ve done it wrong, or I have the wrong OpenGL drivers?

With implementation I meant the drivers.

At least that’s what I get out of the spec. It says something like ‘after enabling color material the current material continuously tracks the current color’. There doesn’t seem to be an exception to this rule concerning push/pop operations.