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);
Learning VBO
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.
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.
Enabling with no texture (I'm not sure) will give you (0,0,0,0) colored pixels.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement