Original Post
I get exactly the same performance from vbo''s as i get from normal vertex arrays, so my question, is this because my app is fill rate limited so memory bandwidth is incidental?
void TRenderer :: BuildVBuffer( TVBInfo* pInfo )
{
pInfo->VBO = pInfo->VBO && mVBOAvail;
if( pInfo->VBO )
{
glGenBuffers( 1, &pInfo->RCID );
glBindBuffer( GL_ARRAY_BUFFER_ARB, pInfo->RCID );
glBufferData( GL_ARRAY_BUFFER_ARB, pInfo->Size * pInfo->Count, pInfo->Data, GL_STATIC_DRAW_ARB );
}
}
void TRenderInterface :: BindBuffer( TVBInfo* pBuffer )
{
mBuffer = pBuffer;
mBuffer->VBO ? glBindBuffer( GL_ARRAY_BUFFER_ARB, mBuffer->RCID ) : glBindBuffer( GL_ARRAY_BUFFER_ARB, 0 );
for( int i = 0; i < mNumTexUnits; ++i ) mTexCoordsBound[i] = false;
mColorsBound = mNormalsBound = mSecColorsBound = mVerticesBound = false;
}
void TRenderInterface :: BindVertices( TType pType, int pNumElements, uint pOffset )
{
if( mBuffer->VBO )
glVertexPointer( pNumElements, pType, mBuffer->Stride, (void*)pOffset );
else
glVertexPointer( pNumElements, pType, mBuffer->Stride, (char*)mBuffer->Data + pOffset );
if( !mVerticesActive ) glEnableClientState( GL_VERTEX_ARRAY );
mVerticesBound = mVerticesActive = true;
}
void TRenderInterface :: DrawElements( TType pType, TShape pShapes, TIBInfo* pBuffer )
{
SetBufferStates();
if( pBuffer->VBO )
{
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER_ARB, pBuffer->RCID );
glDrawElements( pShapes, pBuffer->NumIndices, pType, 0 );
glBindBuffer( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
}
else glDrawElements( pShapes, pBuffer->NumIndices, pType, pBuffer->Indices );
}
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more