PDA

View Full Version : Vertex Array Range performance blues



11-28-2002, 05:01 PM
I am trying to get nVidia's VAR extensions to work but I don't see much of a performance change compared to the traditional glDrawElements usage. I don't know what I am doing wrong here.

I am using the XP 40.72 WHQL drivers (OpenGL version 1.4.0) and have a GF4 Ti 4200 running on a P4, 256 Meg RAM

briefly, what I do is:

1) At startup:

i) Allocate memory and setup with:
varmemory=wglAllocateMemoryNV(size,0.0f,0.0f,0.5f) ; // size,0,0,1 almost no effect
glVertexArrayRangeNV(size,varmemory);
glEnableClientState(GL_VERTEX_ARRAY_RANGE_NV);


ii) One time setup:
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);


2) For each frame:

i) Construct dynamic geometry in standard memory (ie: console characters). In this case, each "character" is simply 2 triangles from 4 vertices arranged in 0,1,2,2,1,3 index order (like a quad).

ii) Copy the block of data from i) to an unused portion of the "varmemory" block allocated in step 1) above (in a sequential manner).

iii) Set up the pointers:
glVertexPointer(3,GL_FLOAT,stride,vert_address);
glTexCoordPointer(2,GL_FLOAT,stride,tc_ddress);
glColorPointer(4,GL_UNSIGNED_BYTE,stride,color_add ress);

The data is all 4 byte aligned, the stride is 36

iv) Draw the geometry:
glDrawElements(GL_TRIANGLES,nElems,GL_UNSIGNED_INT ,elems);
(Blending is enabled, 1 texture only, "elems" is of type int and is in standard memory. I am not using GL_INDEX_ARRAY.)


I am not mixing any other rendering calls with the VAR extension so the GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV has no effect.

The results are the same whether windowed or full screen - about 100 fps with 10K triangles. (Actually, that's only 1 million tris which is not great in either case). I would assume there should be some larger difference with the VAR extensions if I were doing things correct.

PS: I am working on the console first - this is in ortho mode but I did not think that would affect the performance.


Any help would be greatly appreciated.