PDA

View Full Version : Slow VBO Bunnies



MojoMagic
09-09-2003, 07:01 AM
Hi all,

OK, here's the deal.
Loading the stanford bunny OK. Runs at 6.75 mpoly/sec using glDrawElements from system RAM.
Same mesh from a VBO gives me 2.9mpoly/sec. Somewhat less than spectacular.

I'm guessing the fault is with my code (below). Any ideas?





// Setup VBO
glGenBuffersARB( 1, &VBO_VertBuff );
glGenBuffersARB( 1, &VBO_NormBuff );

// Copy Vertex and Normal data into VBOs
glBindBufferARB( GL_ARRAY_BUFFER_ARB, VBO_VertBuff );
glBufferDataARB( GL_ARRAY_BUFFER_ARB, NumVerts*sizeof(CVector3), pVerts, GL_STATIC_DRAW_ARB );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, VBO_NormBuff );
glBufferDataARB( GL_ARRAY_BUFFER_ARB, NumVerts*sizeof(CVector3), pVertNormals, GL_STATIC_DRAW_ARB );


loop
{
if( UseSystemRAM ) // 6.75 mpoly/sec
{
glDeleteBuffersARB( 1, &VBO_VertBuff );
glDeleteBuffersARB( 1, &VBO_NormBuff );

glVertexPointer( 3, GL_FLOAT, 0, pVerts );
glNormalPointer( GL_FLOAT, 0, pVertNormals );
}
elseif( Use VBO ) // 2.9 mpoly/sec
{
glBindBufferARB( GL_ARRAY_BUFFER_ARB, VBO_VertBuff );
glVertexPointer( 3, GL_FLOAT, 0, BUFFER_OFFSET(0) );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, VBO_NormBuff );
glNormalPointer( GL_FLOAT, 0, BUFFER_OFFSET(0) );
}

glDrawElements( GL_TRIANGLES, NumFaces*3, GL_UNSIGNED_INT, pFaces );
}



system:
-Athlon 24000
-512MB RAM
-GeForce 4200 (det45.23)
-WinXP
-VC6 (spack5?)

[This message has been edited by MojoMagic (edited 09-09-2003).]

[This message has been edited by MojoMagic (edited 09-09-2003).]

[This message has been edited by MojoMagic (edited 09-09-2003).]

MojoMagic
09-09-2003, 07:12 AM
As you can see this is very hacky... Even for pseudo-code (sorta).
But is there anything fundamentally wrong with what I'mm doing?

3k0j
09-09-2003, 07:16 AM
Originally posted by MojoMagic:
system:
-Athlon 24000

Maybe your system is overclocked a bit too much?

http://www.opengl.org/discussion_boards/ubb/wink.gif

zeckensack
09-09-2003, 08:17 AM
Tried with UNSIGNED_SHORT indices and/or indices in an ELEMENT_ARRAY_ARB VBO?

Csiki
09-09-2003, 08:29 AM
And what is the speed if you use VBO for the indices also?

TheSillyJester
09-09-2003, 11:03 AM
GeForce 4200 (det45.23) this combo run very slowly, as the driver has a bad optimisation for VBO, try 44.03 they was better imho.

But in my case the perf aren't so slow, it's just like a raw pointer in sys ram. Maybe you got another problem, or it's nvidia drivers misoptimization too.

namespace
09-09-2003, 12:32 PM
Dont use 2 Vbos at the same time.
Try an interleaved format.