I am drawing a square with glDrawArrays() as follows:
glTranslatef(0.0f,0.0f,-6.0f);
const GLfloat quadVertices[] = { -1.0f, 1.0f, 0.0f,
1.0f, 1.0f, 0.0f,
1.0f,-1.0f, 0.0f,
-1.0f,-1.0f, 0.0f
};
glVertexPointer(4, GL_FLOAT, 0, quadVertices);
glDrawArrays(GL_QUADS, 0, 4);
The output is not as expected.
I believe you want:
glVertexPointer(3, GL_FLOAT, 0, quadVertices);
as you are only using 3 floats per vertex, not 4.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With