Texturing Problem using GL_NV_vertex_array_range

When I use the GL_NV_vertex_array_range & wglAllocateMemoryNV extensions, textures (and even vertices position if indexed) are badly placed.

If I don’t use this extension, my performences are about 15% below DirectX8.1…, but with it it’s about 10% ahead DirectX.

I actually use :

  • glTexCoordPointer(2, GL_FLOAT, 0, TextureCoordBuffer);

Should I use a different way to store the texture or texure coordonates (or even vertices) when using this extension ?

My goal is to have the best performances, so, is there any other way to increase FPS ?
Notice that I’m forced to use dynamic storage for vertices and textures …

Thx
Melchizedek!

Make sure you call
glEnable(GL_VERTEX_ARRAY_RANGE_NV)
before rendering from video/AGP memory, and glDisable(GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV)
before rendering from system memory (you’ll want to batch your objects depending on if their vertex data is in system or AGP memory so you only have to call those a minimum amount of times).
Other than that I’m not sure what the bug could be… maybe make sure that your pointers are 32 bit aligned, that wglAllocateMemoryNV really returns a pointer, and most importantly, make sure that you’re allocating enough memory to hold the vertex data of the meshes you’re trying to render.

Since you say indexing makes the problem worse: what is your video card? If it’s below a GeForce3, the index arrays have to reside in system memory.

Originally posted by Dodger:
Make sure you call
glEnable(GL_VERTEX_ARRAY_RANGE_NV)
before rendering from video/AGP memory, and glDisable(GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV)
before rendering from system memory (you’ll want to batch your objects depending on if their vertex data is in system or AGP memory so you only have to call those a minimum amount of times).

I’ve maybe made an error with glDisable(GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV)

Originally posted by Dodger:
Other than that I’m not sure what the bug could be… maybe make sure that your pointers are 32 bit aligned, that wglAllocateMemoryNV really returns a pointer, and most importantly, make sure that you’re allocating enough memory to hold the vertex data of the meshes you’re trying to render.

I’ve already verified all that :stuck_out_tongue:

Originally posted by Dodger:

Since you say indexing makes the problem worse: what is your video card? If it’s below a GeForce3, the index arrays have to reside in system memory.

I work on a GeForce3.

I’ll look for a bug with GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV, and hope that is the problem.

thx

I’ve corrected the probleme,and now texturing works fine.

But I have performence problems …
I’ve got 122FPS with this extension and 300FPS without.

My programme spend 94% of time in the fontion glDrawElements :stuck_out_tongue:

melchizedek.

glEnable is wrong. You should use:-

glEnableClientState(GL_VERTEX_ARRAY_RANGE_NV);

Originally posted by knackered:
[b]glEnable is wrong. You should use:-

glEnableClientState(GL_VERTEX_ARRAY_RANGE_NV);[/b]

Dodger made a little mistake …
I already use glEnableClientState

thx
melchizedek

Urk… yeah, apologize for that, glEnable/DisableCLIENTSTATE is, of course, right.

As for the performance… I hope you’re not copying any static mesh data to video memory every frame, are you?

One more thing - make sure your index array is in system memory, rather than memory you allocate with wglAllocMemoryNV.
All attribute arrays (vertex/texcoord/colours) should be in AGP/Video memory, while all index arrays should be in system memory (allocated with something like malloc/new).