wglAllocateMemoryNV problem

previously:
Vertex= new float [9];

now:
Vertex=(float )wglAllocateMemoryNV(9sizeof(float),.0f,.0f,1.0f);

Everything is OK, it renders but it’s slower!!! Why?

Simply getting AGP or video memory, without setting up VAR, will make the CPU read back vertex data from uncached memory, which is slow.

  • Matt

But been able to get the proc address of wglAllocateMemoryNV doesn’t mean that you have the VAR extension… or does it? If it does how do I use it? My code is like this:

Vertex1=wglAllocateMemoryNV(…);
Vertex2=wglAllocateMemoryNV(…);
while(1)
{
glVertexPointer(…,Vertex1);
glDrawElements(…);

glVertexPointer(…,Vertex2);
glDrawElements(…);
}

Where do I put to calls to VAR?

You should allocate only one block of memory, not two.

Add a call to VertexArrayRangeNV at the start of the program.

The existence of NV_vertex_array_range implies that wglAllocateMemoryNV must be available. wglAllocateMemoryNV by itself is utterly useless.

  • Matt

OK thanks!!!

You may have already done this, but…

Please check out the VAR/fence whitepaper and demo on the NVIDIA Developer Site (www.nvidia.com/Developer). There are a number of “gotchas” related to data formats and alignment that can seriously impair your VAR performance, and the paper covers all these and more…