PDA

View Full Version : Texturing Problem using GL_NV_vertex_array_range



melchizedek
06-25-2002, 05:53 AM
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!

Dodger
06-25-2002, 06:33 AM
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.

melchizedek
06-25-2002, 08:09 AM
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 :p


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 http://www.opengl.org/discussion_boards/ubb/smile.gif

melchizedek
06-26-2002, 03:23 AM
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 :p

melchizedek.

knackered
06-26-2002, 04:31 AM
glEnable is wrong. You should use:-

glEnableClientState(GL_VERTEX_ARRAY_RANGE_NV);

melchizedek
06-26-2002, 04:51 AM
Originally posted by knackered:
glEnable is wrong. You should use:-

glEnableClientState(GL_VERTEX_ARRAY_RANGE_NV);
Dodger made a little mistake ...
I already use glEnableClientState

thx
melchizedek

Dodger
06-26-2002, 11:16 AM
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?

knackered
06-26-2002, 12:39 PM
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).