PDA

View Full Version : How to delete a mesh?



mangusta
08-07-2005, 09:21 AM
Hi to everybody!
I want to creat a running mesh on my screen and I have all the frames I need in a data structure.
When I load a mesh, I would like to delete the previous one... how can I do it?
Every mesh is loaded in this way:

void Mesh::Disegna(int n) {
int indice;
glBegin(GL_TRIANGLES);
for(int i=0; i minor nfac; i++)
indice = f[i].v0;
glTexCoord2f(s[indice].s0, t[indice].t0);
glVertex3f(mat[n].fot[indice].x, mat[n].fot[indice].y,mat[n].fot[indice].z);

indice = f[i].v1;
glTexCoord2f(s[indice].s1, t[indice].t1);
glVertex3f(mat[n].fot[indice].x, mat[n].fot[indice].y,mat[n].fot[indice].z);

indice = f[i].v2;
glTexCoord2f(s[indice].s2, t[indice].t2);
glVertex3f(mat[n].fot[indice].x, mat[n].fot[indice].y,mat[n].fot[indice].z);

glEnd();
}

Then I call this function passing the index i, which is the frame I want to load for the numbers of frame I have.

Thanks a lot
Mangusta

T101
08-11-2005, 07:48 AM
Unless you use that code from within the definition of a display list, you don't load anything with the code you posted.

Deleting and allocating objects is pretty much the whole essence of C++ programming.
If you have a specific problem, in which case you should post a class definition (member variables), constructor, destructor and any function that allocates storage for the mesh.
Otherwise I'd suggest reading up on the basics first.