glDrawArray vs Normal Render

I want to render data below

glBegin(Triangle)
for i = 0; i < n; i++
{
v1 = a1 * w + a2 * w;
v2 = b1 * w + b2 * w;
v3 = c1 * w + c2 * w;
glVertex(v1);
glVertex(v2);
glVertex(v3);
}
glEnd();

vs

vertex * v = new vertex[n * 3];
for i = 0; i < n; i++
{
v[i * 3] = a1 * w + a2 * w;
v[i * 3 + 1] = b1 * w + b2 * w;
v[i * 3 + 2] = c1 * w + c2 * w;
}
glEnableClient(GL_Vertex);
glVertexPointer(3, Gl_float, 0, v);
glDrawArray(Triangle, 0,n * 3);
glDisableClient();

Which faster than?.

The second would be faster if you weren’t allocating memory for your verts every time. Why are you doing this? It’s bad programming.
Vertex arrays are faster than immediate mode because they don’t require as many calls into the opengl api.

In terms of performance, nvidia says glDrawElements is slightly faster. It depends on the hardware, but that one seems to be more popular. Compiled lists are suppose to be intelligently optimized by the driver I read, althought I don’t use them much.

The Range version (VAR) should give you better performance as long as you respect the limitations for the buffer size.
I think that about covers it. There are long discussions on what to use on this very board

/edit/ slighly faster than glDrawArray that is.

V-man

[This message has been edited by V-man (edited 07-19-2002).]