Foxbat
02-13-2007, 05:40 PM
I'm using a VBO in conjunction with a vertex program. Initially the rendering is very slow ( slower than using glVertex calls ) but after rotating the object around awhile the performance will suddenly and dramatically improve.
As I mentioned, performance is OK when using the vertex program in conjunction w/ glVertex calls instead of using the VBO. So, at least for now, I think the problem lies in how I'm using VBO's and not the vertex program.
HW: Geforce 7800
Driver: 93.71
On startup the VBO is initialized as:
glGenBuffersARB( 1, &cyl_buffer );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, cyl_buffer );
glBufferDataARB( GL_ARRAY_BUFFER_ARB, TOTAL_NUM_CYL_PTS * 4 * sizeof( float ),
cylPts, GL_STATIC_DRAW_ARB );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
When the VBO is to be used:
glEnableClientState( GL_VERTEX_ARRAY );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, cyl_buffer );
glVertexPointer( 4, GL_FLOAT, 0, NULL );
Using the VBO: The glDrawArrays call is inside a loop that also makes several calls to glVertexAttrib4fvARB to setup the vertex program.
glDrawArrays( GL_TRIANGLE_STRIP, 0, TOTAL_NUM_CYL_PTS );
Upon completion:
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
glDisableClientState( GL_VERTEX_ARRAY );
As I mentioned, performance is OK when using the vertex program in conjunction w/ glVertex calls instead of using the VBO. So, at least for now, I think the problem lies in how I'm using VBO's and not the vertex program.
HW: Geforce 7800
Driver: 93.71
On startup the VBO is initialized as:
glGenBuffersARB( 1, &cyl_buffer );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, cyl_buffer );
glBufferDataARB( GL_ARRAY_BUFFER_ARB, TOTAL_NUM_CYL_PTS * 4 * sizeof( float ),
cylPts, GL_STATIC_DRAW_ARB );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
When the VBO is to be used:
glEnableClientState( GL_VERTEX_ARRAY );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, cyl_buffer );
glVertexPointer( 4, GL_FLOAT, 0, NULL );
Using the VBO: The glDrawArrays call is inside a loop that also makes several calls to glVertexAttrib4fvARB to setup the vertex program.
glDrawArrays( GL_TRIANGLE_STRIP, 0, TOTAL_NUM_CYL_PTS );
Upon completion:
glBindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
glDisableClientState( GL_VERTEX_ARRAY );