Ok I’m working on a new demo that does a few different cool effects using quake 3 bsp files as the way the world geometry is rendered. Well that part is fine and runs pretty fast, but I just added VBO (which I havn’t even thought about in quite a while) and for some reason I did not get any speedup. I have another demo that renders a highly tesselated sphere and I get a 2x framerate jump as I expected when it was written. But with my latest demo the framerate is exactly the same. What exactly does this mean? I’m not using any shaders just yet either. Everything is being rendered with a single texture only right now.
Each time my “emit” function gets called (this is where glDrawRangeElements gets called) is where I setup the pointers to the vertex and tex coord data as it changes many times each frame. I thought by calling glVertexPointer right before I render liks this would be causing the problem but I don’t think so because there are many 3d apps that render this way.
Just for reference here is my main render function if anyone is interested.
void CRender::Emit( void )
{
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_vboObjectID );
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof( float ) * 4 * m_input.num_verts, m_input.pos, GL_STREAM_DRAW_ARB );
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, m_vboIndexObjectID );
glBufferDataARB( GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof( unsigned int ) * m_input.num_elems, m_input.elems, GL_STREAM_DRAW_ARB );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_vboTexID );
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof( float ) * 2 * m_input.num_verts, m_input.st, GL_STREAM_DRAW_ARB );
glBindTexture( GL_TEXTURE_2D, m_pTextureArray[m_iCurrTexture] );
glEnable( GL_TEXTURE_2D );
glEnableClientState( GL_INDEX_ARRAY );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_vboTexID );
glTexCoordPointer( 2, GL_FLOAT, 0, BUFFER_OFFSET( 0 ) );
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, m_vboIndexObjectID );
glIndexPointer( GL_UNSIGNED_INT, 0, BUFFER_OFFSET( 0 ) );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_vboObjectID );
glVertexPointer( 3, GL_FLOAT, sizeof( float ) * 4, BUFFER_OFFSET( 0 ) );
glDrawRangeElements( GL_TRIANGLES, 0, m_input.num_elems - 1, m_input.num_elems, GL_UNSIGNED_INT, BUFFER_OFFSET( 0 ) );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, NULL );
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, NULL );
glDisableClientState( GL_INDEX_ARRAY );
glDisable( GL_TEXTURE_2D );
m_input.num_elems = 0;
m_input.num_verts = 0;
}
It’s either not going to give me a speed up in this particular case or I’m just doing something dumb. Which the latter is the most likely.
BTW, my map I’m using has less than 5000 polys and every poly is always visible. I’m using PVS but my map isnt complex enough to really benefit from it.
Thanks.
-SirKnight