Learning VBO

Started by
2 comments, last by CirdanValen 14 years, 3 months ago
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);
Advertisement
Okay, I found the problem: I had blending enabled. Why does a textureless quad dislike blending?
I maybe you should disable texturing.

Enabling with no texture (I'm not sure) will give you (0,0,0,0) colored pixels.
Aha...disabling texturing did it. Thanks!

This topic is closed to new replies.

Advertisement