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?