glDrawElements segfault

Started by
4 comments, last by glvaxon 16 years, 4 months ago
glDrawElements crashes with segfault on large vertex/index arrays. If I have a vertex array of 28000 vertices and the first triangle indices are 5 7055 20969, I get a segfault. glEnableClientState(GL_INDEX_ARRAY); glVertexPointer(4, GL_FLOAT, 0, pvertex); glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, pindex); // -> crashes here I tried it with GL1.2 on several video cards, but the result is the same. However it works fine on with small vertex indices for the first tirangle (e.g 0, 1, 2) Are there any known limitations of the array/sizes, or index gaps? Thanks.
Advertisement
Just a guess, try:

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(4, GL_FLOAT, 0, pvertex);
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, pindex);
Oops, sorry, originally it was GL_VERTEX_ARRAY in the code I try :)
Just a copy/paste error when I typed the post.

Thanks.
Looks like it always crashes if the indices of the first triangle are greater than 6518 :(
Are you able to extract coordinates yourself without it crashing?

pvertex[pindex[0]]
pvertex[pindex[1]]
pvertex[pindex[2]]
..
..
Yes, I am.
Looks like I've got it.
Disabling all other client states helps.
It appears I forgot to disable NORMAL_ARRAY from the previous object.

Thanks.

This topic is closed to new replies.

Advertisement