just another newbie question about vertex arrays...:))

shortly, i have to rebuild my vertex arrays every frame. is it normal, or it’s just vasting of cpu time? becase i can’t realize much stuff without it.

for example, when i’ve got a model and i want to compute something between two frames… new coordinates are required and i must build arrays again…

also my landscape is stored in a form which needs rebuilding of arrays (it’s stored in a small pieces relative to 0,0,0)

i just want to know if it’s normal to start everything from scratch every frame. itn’t there some other trick? heeeelp plz and i will love you forever

Originally posted by miko:
for example, when i’ve got a model and i want to compute something between two frames… new coordinates are required and i must build arrays again…

If you mean “keyframe interpolation”, you can use vertex programs to interpolate vertices on the GPU instead of CPU. Though, it will give a significant gain only if the hardware supprots it, at least GeForce3+ or Radeon8500+.

Originally posted by miko:
also my landscape is stored in a form which needs rebuilding of arrays (it’s stored in a small pieces relative to 0,0,0)

If your terrain are small piece centered on (0,0,0) you might use glTranslate. For instance, if your terrain piece rendering function looks like this :
void renderPiece(PieceOfTerrain* piece, Offset* offset)
{
int i;
glBegin(GL_QUADS);
for (i=0 ; i<piece->numVertex ; i<++)
glVertex3f(piece->vertex[i]->x+offset->x, piece->vertex[i]->y+offset->y, piece->vertex[i]->z+offset->z);
glEnd();
}

You may replace it with that :
void renderPiece(PieceOfTerrain* piece, Offset* offset)
{
int i;
glPushMatrix();
glTrasnlatef(offset->x, offset->y, offset->z);
glBegin(GL_QUADS);
for (i=0 ; i<piece->numVertex ; i<++)
glVertex3f(piece->vertex[i]->x, piece->vertex[i]->y, piece->vertex[i]->z);
glEnd();
glPopMatrix();
}

Originally posted by miko:
i just want to know if it’s normal to start everything from scratch every frame. itn’t there some other trick?

There are always tricks, but rare are tricks that work for everything. The above “vertex program trick” and “translate trick” are good for above examples, but those tricks are really different. I wouldn’t mind interpolating keyframes with glTranslate, and I wouldn’t mind translating terrain pieces with vertex programs !

Originally posted by miko:
heeeelp plz and i will love you forever

Well, if you’re a blonde with big t… cough, never mind

yeah, thanks for all your suggestions… btw have you ever seen blonde with big t trying to do anything with gl?