void Model::Render()
{
int loop1, loop2, loop3;
for(loop1 = 0; loop1 < numgroups; loop1++)
{
glBegin(GL_TRIANGLES);
for(loop2 = 0; loop2 < groups[loop1].numTriangles; loop2++)
{
int triangleindex = groups[loop1].triangleIndices[loop2];
const MS3D_Triangle_Var* tri = &triangles[triangleindex];
for(loop3 = 0; loop3 < 3; loop3++)
{
int index = tri->vertexIndices[loop3];
glNormal3fv(tri->normals[loop3]);
glTexCoord2f(tri->u[loop3], tri->v[loop3]);
glVertex3fv(vertices[index].vertex);
}
}
glEnd();
}
}
Milkshape model rendering error
When trying to render my model with the render function I get an error saying that memory can't be accessed at the start of the second "for" loop. Everything was working fine yesterday but now I'm getting this error and I don't know how to fix it. Anyone have an idea how to get rid of this error??
[edited by - Jon723 on May 21, 2003 4:40:31 PM]
www.lefthandinteractive.net
Hmm you might want to check and make sure that groups is initialized and that it has as many members as numgroups.
Oh.. and on a side note, you might want to considering doing
for(int var = 0; statement; var++)
That makes it so you don''t have to define the variables at the top, but then again thats just a personal preference.
Oh.. and on a side note, you might want to considering doing
for(int var = 0; statement; var++)
That makes it so you don''t have to define the variables at the top, but then again thats just a personal preference.
Other side note....
Do not declare you variables into a for loop... it slows down the whole code...
however consider a check on the initialization of the values, most of the memory access error are vecause of that.
---------------------------------------
There are 10 type of people:
those who knows binary code
and those who doesn''t
---------------------------------------
Do not declare you variables into a for loop... it slows down the whole code...
however consider a check on the initialization of the values, most of the memory access error are vecause of that.
---------------------------------------
There are 10 type of people:
those who knows binary code
and those who doesn''t
---------------------------------------
---------------------------------------There are 10 type of people:those who knows binary codeand those who doesn't---------------------------------------
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement