PDA

View Full Version : VBO - glDrawElements



Coluna
09-25-2003, 09:46 AM
Hi;
Im changing my code for using VBOs instead of simple vertex array, but it slows me down a lot. I think the error may be on glDrawElements, because im using an array of index to draw the tri strips. When i used only va it worked fine.
Im doing this:

glBindBufferARB( GL_ARRAY_BUFFER_ARB, vbo_id );
glVertexPointer( 3, GL_FLOAT, 0, BUFFER_OFFSET (offset));
glDrawElements(GL_TRIANGLE_STRIP, (TER_PATCH_SIZE*2)/k+2 ,GL_UNSIGNED_SHORT, &index_aux[lod]]);

In the last line, i use a pre-stored array of indexes with varius lods, and the lod tells me what lod to use.
When i use vbo, the the mesh came into a mess, and the fos slows dows a lot.
Can anybody help me??

Thanxs all

Coluna
09-26-2003, 07:55 AM
its me again....i modified nehe´s lesson about using VBO, replacing this
glDrawArrays( GL_TRIANGLES, 0, g_pMesh->m_nVertexCount );
by
glDrawElements(GL_TRIANGLES, 65536 ,GL_UNSIGNED_SHORT, index);

where index is a big array [65536] with values 0,1,2,3,4...
It worked, but in my code no....any sugestions?

vincoof
09-26-2003, 09:31 AM
Do you mean that this was in your code :
glDrawArrays( GL_TRIANGLES, 0, g_pMesh->m_nVertexCount );

and that this was in NeHe's code :
glDrawElements(GL_TRIANGLES, 65536 ,GL_UNSIGNED_SHORT, index);

?

I feel a bit confused on your wording, please excuse me.