Archived

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

kRogue

questionon glMultiDrawElementsEXT

Recommended Posts

Hi all, A while back someone had suggested to me to use glMultiDrawElementsEXT to draw several traingle strips/fans at once... the prototype I have found is: void glMultiDrawElements( GLenum mode, GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount) this is how I _tried_ to use it: GLsizei stripCount=# of triangle strips GLsizei *ssCounts; GLvoid **stripIndexes=array of indices for strips, i.e. stripIndexes[0] is the list of indexes for the 0th triangle strip and it has legnth ssCounts[0] it is created via:
 ssCounts=new GLsizei[stripCount];
 stripIndexes=new GLvoid*[stripCount];

for(i=0;i<stripCount;i++)
{
 Gluint *currentStrip;
 
 ssCounts[i]=NumberOfTriangles in i'th strip
 currentStrip=new GLuint[NumberOfTriangles in i'th strip]
 stripIndexes[i]=currentStrip;
}
and then the index arrays are filled. the folowing code works fine:
for(i=0;i<stripCount;i++)
{
   Gluint *currentStrip;
   currentStrip=(GLuint*)stripIndexes[i];
   glDrawElements(GL_TRIANGLE_STRIP,ssCounts[i],GL_UNSIGNED_INT, stripIndexes[i]);
}
but this code crashes: glMultiDrawElements(GL_TRIANGLE_STRIP, ssCounts, GL_UNISGNED_INT, (const GLvoid**)stripIndexes,stripCount); any help would be greatly appreciated, I just want the call to glMultiDrawElements to do the same as code of the loop... the only difference between the 2 codes is that the loop is replaced with the call to glMultiDrawElements..... I imagine the driver has that loop anyways there, but probably much better optimized than the compiler would do...

Share this post


Link to post
Share on other sites