• Advertisement
Sign in to follow this  

Learning VBO

This topic is 2983 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);
	glBindBufferARB(GL_ARRAY_BUFFER_ARB,0);

// The render method

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

	glVertexPointer(2, GL_FLOAT, 0, 0);
	
	glEnableClientState(GL_VERTEX_ARRAY);
	
	glDrawArrays(GL_QUADS, 0, 4);
	
	glDisableClientState(GL_VERTEX_ARRAY);
	
	glBindBufferARB(GL_ARRAY_BUFFER,0);

Share this post


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