Not all mesh elements are drawn using function calls in GMSH API
Hello,
I am currently using GMSH 3.0.4 API in my application to create 2D meshes. I have been noticing that there are a number of mesh elements that are simply not beginning drawn in the application when I use the following code:
p_modelMesh->getEntities(entityList, 4);
glBegin(GL_LINES);
int numOfElements = 0;
for(unsigned int i = 0; i < entityList.size(); i++)
{
int temp = entityList[i]->getNumMeshElements();
for(unsigned int j = 0; j < entityList[i]->getNumMeshElements(); j++)
{
numOfElements++;
int test = entityList[i]->getMeshElement(j)->getNumVertices() - 1;
for(unsigned int k = 0; k < entityList[i]->getMeshElement(j)->getNumVertices() - 1; k++)
{
glVertex2d(entityList[i]->getMeshElement(j)->getVertex(k)->x(), entityList[i]->getMeshElement(j)->getVertex(k)->y());
glVertex2d(entityList[i]->getMeshElement(j)->getVertex(k + 1)->x(), entityList[i]->getMeshElement(j)->getVertex(k + 1)->y());
}
}
}
glEnd()
As we can see, I am getting a list of all of the entities and from there accessing all of the mesh elements within each entity. At first, I though that my own code had an issue but then when I compared the number of mesh elements for each entity in my application agains the GMSH GUI application, the numbers are the same?
I am able to confirm that when I export the mesh as a VTK file in my application, all of the mesh elements are exported properly.
I am wondering if this is a bug in the software? If it might be present in this repos version or if this is a bug in the 3.0.4 release and that I missed the update in later releases?
Or if this is not the best way to access all of the mesh elements. If so, then what method is the preferred method for accessing all of the mesh elements in order to draw them on a OpenGL canvas?