Jump to content
  • Advertisement


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


ARB Vertex Buffer Objects and textures

This topic is 5486 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 having some problems getting VBO's to work. Whenever I try to use a texture it crashes. I put the vertex data in a static draw buffer using glBindBufferARB and glBufferDataARB and I use glDrawElements to draw it. My array of indicies is in system memory, as is my tex coord array. It works fine when I don't use textures although I don't notice any speed increase. my code basically looks like this, am I do something wrong?
#define BUFFER_OFFSET(i) ((char *)NULL + (i))

glBufferDataARB(GL_ARRAY_BUFFER_ARB, width*height*3*sizeof(GLfloat), vertexData, GL_STATIC_DRAW_ARB);

while (drawing)
glVertexPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(0));
glTexCoordPointer(2,GL_FLOAT,0, texCoordData);


glDrawElements(GL_TRIANGLE_STRIP, numElements, GL_UNSIGNED_INT, indexData);

Sorry the code is so bunched up, I cant seem to put blank lines in it.

Share this post

Link to post
Share on other sites
You should add a glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); before pointing the texcoords, since that tells opengl that now it should use system memory and not VBO:s

Share this post

Link to post
Share on other sites

  • 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!