pongkm

07-18-2002, 11:57 PM

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?.

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?.