using vertex array

Hi,

I have a list of quads and trias, what is the best way to
render them? would using vertex array help? right now I am drawing using glBegin(GL_POLYGON) in a for loop
for the number of elements. something like this.

for(i=0; i<n_elements; i++)
{
glBegin(GL_POLYGON);
glVertex3dv(first point);


glVertex3dv(last point);
glEnd();
}

Also the performance is almost 10 times slow over nextwork ( telnet to some other m/c and give display on some other m/c).

right now I am taking care not to draw the same edge twice. would the vertex array do that for me?

thanks in advance.

regards
satya

Hello satya!

First of all, you should always render triangles instead of other polygons because thats the way cards work. If you tesselate the polys, your card won’t have to do that for you.

Second point, yes, vertex arrays would help you to speed up the render. Instead of telling your card to render a triangle each time, you will be able to tell the card to render an amount of triangles at once. That causes less overhead.

There are other ways to speed up the render, such us Compiled Vertex Arrays, Vertex Array Range, etc. But you can start with VAs and then upgrade your program.

I hope it helps.

-nemesis-

Yeah vertex arrays will help performance alot, unless it’s just a few polygons. Also you can try using triangle stripes.