VBO & glMultiDrawElements

Im using a VBO to store my indices for my triangles & tri strips. The first “chunk” in the VBO contain all the triangle indices and the rest is all the indices for my triangle strips.

In the render part to draw the triangles no problem, but when drawing the triangle strips, I do not know how and where I can pass the offset in the buffer, and what exactly to pass to glMultiDrawElementsEXT.

The following code was working perfectly with VA but when I switch it using VBO the Triangle Strips rendering cause me serious problem… I google a bit and cannot find not concrete example that is near what I do…

From the code below can someone give me an example of how to use glMultiDrawElements with VBOs…

I got the following code:

glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB,
		 tri_strip.element_index );


// Triangles
if( tri_strip.n_tri )
{
	glDrawElements( GL_TRIANGLES,
			tri_strip.n_tri,
			GL_UNSIGNED_INT,
			(GLvoid *)NULL );
}



// Triangle Strips
glMultiDrawElementsEXT( GL_TRIANGLE_STRIP,
			&tri_strip.n_strip_cnt[0],
			GL_UNSIGNED_INT,
			(GLvoid **)NULL,
			tri_strip.n_strip );

Thank in advance,

Cheers,

From GL_ARB_vertex_buffer_object spec

    How does MultiDrawElements work?

    void glMultiDrawElementsEXT( GLenum mode,
				 GLsizei *count,
				 GLenum type,
				 const GLvoid **indices,
				 GLsizei primcount)
 
        The language gets a little confusing, but I believe it is quite
        clearly specified in the end.  The argument <indices> to
        MultiDrawElements, which is of type "const void **", is an
        honest-to-goodness pointer to regular old system memory, no
        matter whether a buffer is bound or not.  That memory in turn
        consists of an array of <primcount> pointers.  If no buffer is
        bound, each of those <primcount> pointers is a regular pointer.
        If a buffer is bound, each of those <primcount> pointers is a
        fake pointer that represents an offset in the buffer object.

        If you wanted to put the array of <primcount> offsets in a buffer
        object, you'd have to define a new extension with a new target.


	for(i=0; i<primcount; i++) 
	{
	    if (*(count+i)>0) glDrawElements(mode, *(count+i), type, *(indices+i));
	}
 

ok got it working…

cheers