View Full Version : Problems with GLM library

10-13-2008, 01:58 AM
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;


group = model->groups;

while (group)
for (i = 0; i < group->numtriangles; i++)
triangle = &amp;T(group->triangles[i]);

for (j=0; j<3; j++)
assert(triangle->vindices[j]>=1 &amp;&amp; triangle->vindices[j]<=model->numvertices);
glVertex3fv(&amp;model->vertices[3 * triangle->vindices[j]]);
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:
http://img503.imageshack.us/img503/8194/foto1wn7.th.jpg (http://img503.imageshack.us/my.php?image=foto1wn7.jpg)
This is the wrong rendering, the same code is in another file:
http://img206.imageshack.us/img206/3223/weight1ym2.th.jpg (http://img206.imageshack.us/my.php?image=weight1ym2.jpg)
I think there is a problem with vertices, but I don't understand where and why.