Hi,
I try to display few triangular mesh in a QT 3D view. My first triangular mesh is a big closed surface (green on attached pictures). The oppacity of this surface is not complete to be able to see others triangular meshes inside the green one.
Attached pictures
http://w3.gel.ulaval.ca/~geris2/ForumImage/MissingTriangles.jpg
http://w3.gel.ulaval.ca/~geris2/ForumImage/DissapearingTrinagles.jpg
I have two questions.
First one, why on the first surface ( green ) I see the triangles? Is it possible to obtain a uniforme surface without triangles shapes.
Second questions : On the red triangular meshes, when I rotate the view, some triangles seem to dissapear and create an hole in the mesh.
This is the way I display each triangular mesh in the view :
for ( size_t iMesh=0; iMesh<m_MeshList.size(); ++iMesh )
{
if ( iMesh == 0)
glColor4f ( 0, 255, 0, 0.1 );
else
glColor4f ( 255, 0, 0, 1 );
// Create vertices and facets list
//db
int VSize = m_MeshList[iMesh]->GetNbVertice()*3;
int FSize = m_MeshList[iMesh]->GetNbFacet()*3;
//db
GLfloat *vertices = new GLfloat[m_MeshList[iMesh]->GetNbVertice()*3 ];
GLubyte *indices = new GLubyte[m_MeshList[iMesh]->GetNbFacet()*3 ];
size_t iValue=0;
for ( size_t iVertices=0; iVertices<m_MeshList[iMesh]->GetNbVertice(); ++iVertices )
{
vertices[iValue] = m_MeshList[iMesh]->GetVertices()[iVertices].x();
++iValue;
vertices[iValue] = m_MeshList[iMesh]->GetVertices()[iVertices].y();
++iValue;
vertices[iValue] = m_MeshList[iMesh]->GetVertices()[iVertices].z();
++iValue;
}
iValue=0;
for ( size_t iFacet=0; iFacet<m_MeshList[iMesh]->GetNbFacet(); ++iFacet )
{
indices[iValue] = m_MeshList[iMesh]->GetFacets()[iFacet].x();
++iValue;
indices[iValue] = m_MeshList[iMesh]->GetFacets()[iFacet].y();
++iValue;
indices[iValue] = m_MeshList[iMesh]->GetFacets()[iFacet].z();
++iValue;
}
// activate and specify pointer to vertex array
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertices);
//glDrawElements(GL_TRIANGLE_STRIP, 12, GL_UNSIGNED_BYTE, indices);
glDrawElements(GL_TRIANGLES, m_MeshList[iMesh]->GetNbVertice(), GL_UNSIGNED_BYTE, indices);
// deactivate vertex arrays after drawing
glDisableClientState(GL_VERTEX_ARRAY);