# Why are my triangles not being drawn in the color I define?

I render a simple mash structure with Tao (don't think this is relevant) using DisplayList.

Following code appears between

int displayList = Gl.glGenLists(1);
Gl.glNewList(displayList, Gl.GL_COMPILE);


and

Gl.glEndList();


Simplified version of the code, with removed unrelevant parts:

Gl.glBegin(Gl.GL_TRIANGLES);

for (int i = 0; i < triangles.Count; i++)
{
var triangle = triangles[i];

bool ok = false;
var normal = triangle.GetNormal(out ok); //get normal of TRIANGLE

//this method just retrives correct color information here
var visualData = GetVisualData(visual,
visual.RenderSettings, triangle,null, false);

//Set the color for the vertex here. Color is always the same in THIS case
Gl.glColor4f(m_colors[visualData.color.R],
m_colors[visualData.color.G],
m_colors[visualData.color.B],
visualData.transparency);

//for every vertex in triangle
for (int vtx = 0; vtx < triangle.Vertices.Length; vtx++)
{
var v = triangles[i].Vertices[vtx];
Vertex3 v3 = v.Coord;
Gl.glVertex3d(v3.x, v3.y, v3.z); //set vertex
Gl.glNormal3d(normal.x, normal.y, normal.z);  //set normal

}

}

Gl.glEnd();


Accoring to documentation if I set the same color for all 3 vertices of the triangle it must have the solid color. But what I get is:

As you see the colors are not uniform across different triangles, but I'm pretty sure that in this loop the color is not changed, it remains static (I even tried to set constant int values as color , but result is always the same)

Q:

What can be possible reason of this rendering behaviour?

In immediate mode rendering in OpenGL, you open up a sequence of primitives by Begin, emit a bunch of elements in that sequence, and terminate it with End.
There's two choices on how OpenGL could have handled the emission of the elements. One way would be that a Vertex call would create an element and that subsequent calls to functions like Color, Normal, TexCoord would modify those attributes of that vertex.
That is not the case, however. The approach that OpenGL uses is that first you set all the attributes you want with those functions (Color, Normal, etc.), and then emit an immutable element with the Vertex function.
In your code, you do this correctly for Color, but your Normal changes are lagged by one vertex, resulting in inconsistent normals for a face.
In essence, set all the changed vertex attributes first, then invoke Vertex to emit a vertex with those attributes.