Hi! I'm new here. Just started working with OpenGL using MFC. I've run into a problem when filling a polygons triangulated areas with different layers.
1st... I have a simple polygon (5 points in this example). I triangulate that polygon using googled methods to form 3 different triangles to fill. The polygon is in 3D and is a few layers thick.
When I fill the top layer transparently everything looks smooth,
but when filling any layer below it and moving the camera around in 3D space, I see the triangle lines between the layers.
My code is as follows:
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glLineWidth(1);
////////removed code: here I draw the side quads for the 3d polygon
glBegin(GL_TRIANGLES);
for (j=0;j<tcount;j++){
const Vector2d &p1 = triangulationresult[j*3+0];
const Vector2d &p2 = triangulationresult[j*3+1];
const Vector2d &p3 = triangulationresult[j*3+2];
glVertex3f(p1.GetX(),p1.GetY(), zValueForTopLayer);
glVertex3f(p2.GetX(),p2.GetY(), zValueForTopLayer);
glVertex3f(p3.GetX(),p3.GetY(), zValueForTopLayer);
//if i add this code here, i see the lines for the triangles
//glVertex3f(p1.GetX(),p1.GetY(),zValueForBottomLaye r);
//glVertex3f(p2.GetX(),p2.GetY(), zValueForBottomLayer);
//glVertex3f(p3.GetX(),p3.GetY(), zValueForBottomLayer);
}
glEnd();
How do I fix??






