Jump to content
  • Advertisement
Sign in to follow this  

Learning VBO

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

So I decided to try and get VBO working. I already got vertex arrays working, so I figured going an extra step to get VBOs working wouldn't be a bad idea, however it is not easy as I first thought. Right now, I'm just trying to render a simple white quad via VBO, then I'll move forward from there. My vertex array render code is working perfectly fine, but this VBO method isn't displaying anything. I've been reading guides and sample code all day...but I guess I don't understand it or something.
GLfloat vertices[] = {32.0, 10.0,
	10.0, 10.0,
	10.0, 32.0,
	32.0, 32.0};

// The Setup

	glGenBuffersARB(1, &_vbo);
	glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vbo);
	glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(vertices), vertices, GL_STATIC_DRAW_ARB);

// The render method

	glColor4f(1.0, 1.0, 1.0, 1.0);
	glBindBufferARB(GL_ARRAY_BUFFER_ARB, _vbo);

	glVertexPointer(2, GL_FLOAT, 0, 0);
	glDrawArrays(GL_QUADS, 0, 4);

Share this post

Link to post
Share on other sites
I maybe you should disable texturing.

Enabling with no texture (I'm not sure) will give you (0,0,0,0) colored pixels.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!