iDevGames Forums
Crash in glMultiDrawElements - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Crash in glMultiDrawElements (/thread-3100.html)



Crash in glMultiDrawElements - Cochrane - Aug 12, 2007 12:13 PM

I have a rather strange problem at the moment. According to documentation
Code:
glMultiDrawElements(GL_TRIANGLE_STRIP, image->stripElementCounts, GL_UNSIGNED_INT, image->stripElements, image->numTriangleStrips);
should be equivalent to
Code:
for (i = 0; i < image->numTriangleStrips; ++i)
    glDrawElements(GL_TRIANGLE_STRIP, image->stripElementCounts[i], GL_UNSIGNED_INT, image->stripElements[i]);

However, I noticed a slight difference: The second one draws as it should, while the first one doesn't draw correctly and, when adding more indices to the triangle strip, crashes with EXC_BAD_ACCESS. This is, by the way, always the case, not only with GL_TRIANGLE_STRIP. I am using normal vertex arrays, allocated in the heap, if that is relevant (I had crashes earlier when using vertex arrays on the stack instead of VBOs).

An example screenshot (the yellow line is the triangle strip I want to render. At the moment, the image never has more than one triangle strip, though I want to change this in the future):

[Image: glmultidrawelementscrash.png]

The upper part shows with glMultiDrawElements, the lower with a loop and glDrawElements.

Does anyone know what causes this and how to avoid it?

System: Mac OS X 10.4.10, G4, Radeon 9200


Crash in glMultiDrawElements - OneSadCookie - Aug 12, 2007 02:41 PM

OpenGL.org is full of posts saying MultiDrawElements is broken. File a bug and move on.