Jump to content
  • Advertisement
Sign in to follow this  
glvaxon

glDrawElements segfault

This topic is 3968 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Just a guess, try:

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(4, GL_FLOAT, 0, pvertex);
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, pindex);

Share this post


Link to post
Share on other sites
Oops, sorry, originally it was GL_VERTEX_ARRAY in the code I try :)
Just a copy/paste error when I typed the post.

Thanks.

Share this post


Link to post
Share on other sites
Are you able to extract coordinates yourself without it crashing?

pvertex[pindex[0]]
pvertex[pindex[1]]
pvertex[pindex[2]]
..
..

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!