PSilva

03-14-2002, 06:11 PM

I am trying to use the glVertexArrayRangeNV.

I have a buffer with numTriangles (about 130000) triangles:

sizeX = 1188882;

GLFloat* triangles=(GLFloat*)calloc(sizeX, sizeof(GLFloat));

trianglesArray[0] is triangle1 1st vertex

trianglesArray[1] is triangle1 2st vertex

trianglesArray[2] is triangle1 3st vertex

trianglesArray[3] is triangle2 1st vertex

trianglesArray[4] is triangle2 2st vertex

....

big_array = (GLfloat*)wglAllocateMemoryNV(sizeX*sizeof(GLfloat ), 0, 0, 0.5f);

if(big_array)

{

m_memory = big_array;

}

glVertexArrayRangeNV(sizeX*sizeof(GLfloat), big_array);

glEnableClientState(GL_VERTEX_ARRAY_RANGE_NV);

glEnableClientState(GL_VERTEX_ARRAY);

This is done once.

The following code is done every frame:

glVertexPointer(3, GL_FLOAT, 0, trianglesArray);

glLockArraysEXT(0, numTriangles*3); //number of triangles * 3 vertexs per triangle

glDrawArrays(GL_TRIANGLES,0,numTriangles*3);

glUnlockArraysEXT();

This renders 130000 triangles correctly but decreases framerate from 500 fps to 12 fps!

This is with a Celeron 850MHz and a GeForce3 running with OpenGL 1.3.0 and WindowsXP Professional.

What am I doing wrong?

Where can I find a good tutorial or example on GL_NV_vertex_array_range?

Thank you.

PS- I don't know how to setup the index array to use glDrawElements.....

I have a buffer with numTriangles (about 130000) triangles:

sizeX = 1188882;

GLFloat* triangles=(GLFloat*)calloc(sizeX, sizeof(GLFloat));

trianglesArray[0] is triangle1 1st vertex

trianglesArray[1] is triangle1 2st vertex

trianglesArray[2] is triangle1 3st vertex

trianglesArray[3] is triangle2 1st vertex

trianglesArray[4] is triangle2 2st vertex

....

big_array = (GLfloat*)wglAllocateMemoryNV(sizeX*sizeof(GLfloat ), 0, 0, 0.5f);

if(big_array)

{

m_memory = big_array;

}

glVertexArrayRangeNV(sizeX*sizeof(GLfloat), big_array);

glEnableClientState(GL_VERTEX_ARRAY_RANGE_NV);

glEnableClientState(GL_VERTEX_ARRAY);

This is done once.

The following code is done every frame:

glVertexPointer(3, GL_FLOAT, 0, trianglesArray);

glLockArraysEXT(0, numTriangles*3); //number of triangles * 3 vertexs per triangle

glDrawArrays(GL_TRIANGLES,0,numTriangles*3);

glUnlockArraysEXT();

This renders 130000 triangles correctly but decreases framerate from 500 fps to 12 fps!

This is with a Celeron 850MHz and a GeForce3 running with OpenGL 1.3.0 and WindowsXP Professional.

What am I doing wrong?

Where can I find a good tutorial or example on GL_NV_vertex_array_range?

Thank you.

PS- I don't know how to setup the index array to use glDrawElements.....