Sign in to follow this  

Learning VBO

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this