Jump to content
  • Advertisement
Sign in to follow this  
Andrew Lucas

glDrawElements + glTexCoordPoointer = Crash

This topic is 3003 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

I'm trying to implement VBOs into my engine, to render the bsp data much more efficiently. So far, I've succeeded in rendering untextured polygons properly, but when I try passing down a texture coord pointer on any unit, it crashes when I call glDrawElements, and I don't know why.

This is how the texture coord pointer is bound:
glClientActiveTextureARB(unitnum + GL_TEXTURE0_ARB);
glTexCoordPointer(2, GL_FLOAT, sizeof(brushvertex_t), OFFSET(brushvertex_t, texcoord));
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

This is how I bind the VBO:
glGenBuffersARB( 1, &m_uiBufferIndex );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_uiBufferIndex );
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(brushvertex_t)*iNumVerts, m_pBufferData, GL_STATIC_DRAW_ARB );
glBindBufferARB( GL_ARRAY_BUFFER_ARB, NULL );

And this is how I render it:
glDrawElements(GL_TRIANGLES, m_pFacesExtraData[p->flags].indexes.size(), GL_UNSIGNED_INT, &m_pFacesExtraData[p->flags].indexes[0] );

And I have absolutely no idea why the crash occurs. No matter what I try setting the offset to, it won't work. When I was using vertex arrays, everything seemed to work completely fine, but now it's crashing all the time.

Share this post


Link to post
Share on other sites
Advertisement
Actually I feel embarrassed. There was a drawback functionality left in the code, and back when I made this engine, I seem to have made some function calls in the wrong order, so, for example, texture pointers were set before the vbo was bound, I only found it out once I started testing the original code too. :P
Thanks for the help though.

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!