PDA

View Full Version : Compiled Vertex Arrays?



Lloyd
03-18-2003, 08:29 AM
Hi lads,

I'm kinda banging my head against a brick wall at the moment. So, onto the problem...

**********

// given an M by N height field such as:

GLfloat* vertices = new GLfloat[M*N*3];
GLubyte* colours = new GLubyte[M*N*4];
GLfloat* texels0 = new GLfloat[M*N*2];

// draw the triangles within the height field 30 times:

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glVertexPointer(3, GL_FLOAT, 0, vertices);
glColorPointer(4, GL_UNSIGNED_BYTE, 0, colours);
glTexCoordPointer(2, GL_FLOAT, 0, texels0);

glLockArraysEXT(0, M*N);

for(i=0; i<30; i++)
{
glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_INT, indices);
}

glUnlockArraysEXT();

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);

**********

Even thought the extension is enabled (GL_EXT_compiled_vertex_array), locking the vertex arrays when rendering the same height field multiple times makes absolutely no difference in terms of performance. I'm even timing the number of CPU ticks using QueryPerformanceCounter().

I've tried numerous other experiments and I can't seem to generate any increased rendering performance when using this extension. I'm using Microsoft Visual Studio 6.0 C++ on Windows 2000 and running a GeForce3 Ti 500 graphics card with version 41.09 of the Detonator drivers from NVIDIA.

Any ideas why its not improving the frame rate?

regards,

Lloyd

JustHanging
03-18-2003, 08:37 AM
Perhaps your app isn't geometry limited. Are you possibly doing lots of cpu work or consuming lots of fill rate (high overlapping mountains, for example).

-Ilkka

Lloyd
03-18-2003, 08:40 AM
That's all I'm doing i.e. the code above. I'm just doing some experiments on the extension, and I can't see to generate any performance increases.

We're talking well over 100,000 vertices being transferred across the bus per frame, so I would have thought the extension would kick in etc.

Arath
03-18-2003, 08:52 AM
Use VAO or VAR or even now the vertex buffer object extension
http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_buffer_object.txt

harsman
03-18-2003, 10:32 AM
If M*N is large, the Lock is probabbly a nop. If it is really small, you're CPU limited. Try a display list, and make sure you're actually geometry limited.