Hi i'am trying to render a square using VBO. Here is my code
void square() {
if (!squareUpdate) {
GLfloat squarevertices[] = {-0.75f, .75f, 0.0f, 0.75f,
0.75f, 0.0f, 0.75f, -0.75f,
0.0f, -0.75f, -0.75f, 0.0 };
glGenBuffers(1, &VBOid);
glBindBuffer(GL_ARRAY_BUFFER, VBOid);
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * 9, squarevertices,
GL_DYNAMIC_DRAW);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, 0);
glDrawArrays(GL_POLYGON, 0, 9);
} else {
glVertexPointer(3, GL_FLOAT, 0, 0);
glDrawArrays(GL_POLYGON, 0, 9);
}
}
but it only renders half of a square it looks like a triangle
how can i make a box using a vbo?Im sure im missing something
