Hi to all!
I’ve downloaded a modified version of GLM Library from this site: http://devernay.free.fr/hacks/glm/.
I need to acces to vertices of the model (only the vertices) but I’ve some problems.
In this library there is a function called “glmDraw()” if I change this function and I take only this code:
GLuint i, j;
GLMgroup* group;
GLMtriangle* triangle;
assert(model);
assert(model->vertices);
group = model->groups;
while (group)
{
glBegin(GL_TRIANGLES);
for (i = 0; i < group->numtriangles; i++)
{
triangle = &T(group->triangles[i]);
for (j=0; j<3; j++)
{
assert(triangle->vindices[j]>=1 && triangle->vindices[j]<=model->numvertices);
glVertex3fv(&model->vertices[3 * triangle->vindices[j]]);
}
}
glEnd();
group = group->next;
}
It’s runs correctly and I can have the acces to vertices. But if I take this code, and I put them in another file, I obtain strange results.
This is the correct rendering, the code is in the original file:
This is the wrong rendering, the same code is in another file:
I think there is a problem with vertices, but I don’t understand where and why.
Thanks!