color change ignored in a certain situation...

I have code that creates a few display lists. I call a few display lists, then when I call the other to draw a tree, it is drawn with a color set in the previous display list.

This is strange… And I am changing the color in the tree’s display list. This is what doesn’t work:

glColor3f(0.4f, 0.3f, 0.1f);
glBegin (GL_TRIANGLES);
for(i=0 up to i=lots of triangles){
//draw a triangle
}
glEnd(GL_TRIANGLES);

but, when I shove the glColor3f inside the for loop so that the color gets set every triangle, it works fine:

glBegin (GL_TRIANGLES);
for(i=0 up to i=lots of triangles){
glColor3f(0.4f, 0.3f, 0.1f);
//draw a triangle
}
glEnd(GL_TRIANGLES);

This is really bothering me, because I don’t understand why this would happen. Please, any help?

Actually, I realized that it works when I move the glColor3f just inside the glBegin() like this, but still doesn’t have any effect outside of it…???

glBegin (GL_TRIANGLES);
glColor3f(0.4f, 0.3f, 0.1f);
for(i=0 up to i=lots of triangles){
//draw a triangle
}
glEnd(GL_TRIANGLES);

Sounds like a driver bug to me…

  • Matt