View Full Version : How to delete a mesh?

08-05-2005, 12:09 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;
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);


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

08-05-2005, 12:57 AM
excuse me, but this is not loading but straight rendering. you have already loaded your stuff into those mat, f, ... arrays.

this looks like regular vertex animation, where you just render the frame you want, but have stored all frames in memory.

if you want less memory consumption for animation use skeletal animation

08-05-2005, 01:54 AM
Hardly an advanced topic.
You're not meaning glClear?

Your data structures look like you should consider vertex arrays and glDrawElements.
At least use vector versions glTexCoord2fv and glVertex3fv.