Archived

This topic is now archived and is closed to further replies.

Metus

huge performance-loss with glDrawElements

Recommended Posts

as the title mentions; i''ve implemented indexed rendering for my 3ds-loader but the performance drops from 500fps to a merely 80 using glDrawElements, but if i activate the GLA_ARB_vertex_buffer_object, the fps rises to a brilliant 800fps. the index type is an unsigned short and it doesn''t matter how detailed my mesh is, the drop is noticeable

Share this post


Link to post
Share on other sites
that doesn''t sound right, are you calling glDrawElements per
triangle or something?

that could explain it, because if VBO is enabled ther wont be
much throughput at the card will have cached it.

Share this post


Link to post
Share on other sites

GamerSg

I''ve used glCallLists to get 600fps for 62k polygons


silvermace

No not as far as i can se:


void Object3DS::render()
{
glEnableClientState(GL_VERTEX_ARRAY);

if(m_use_VBO)
{
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo_vertex);
glVertexPointer(3, GL_FLOAT, 0, 0);
}
else
glVertexPointer(3, GL_FLOAT, 0, &m_compiled[0]);

glDrawElements(GL_TRIANGLES, 3 * m_facelist.size(), GL_UNSIGNED_SHORT, &m_compindex[0]);
glDisableClientState(GL_VERTEX_ARRAY);}

Share this post


Link to post
Share on other sites
Regular vertex arrays are always going to be slower than VBO or display lists because they''re stored in RAM and all the vertices have to be transferred to the GPU every time you call drawelements. Getting a 10x performance difference between vertex arrays and VBO is not unheard of. (This performance increase is why VBO and display lists exist after all..)

Share this post


Link to post
Share on other sites