Hey,
I’m having some problems drawing a polygon using a vertex array
If I put the vertex data into a glBegin(GL_POLYGON), glEnd() it will work fine but the below code refuses to work. I have enabled the vertex array in another function, this code works if you tell it to draw points or lines but not polygons.
Any ideas?
Thanks
Paul
static GLint vertices[] = { 0.25, 0.25, 0.0,
0.75, 0.25, 0.0,
0.75, 0.75, 0.0,
0.25, 0.75, 0.0 };
static GLfloat colors[] = { 0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
0.0, 0.0, 1.0,
0.0, 0.0, 1.0 };
static GLubyte indices[] = { 0, 1, 2, 3 };
glVertexPointer (3, GL_INT, 0, vertices);
glColorPointer (3, GL_FLOAT, 0, colors);
glDrawElements (GL_POLYGON, 4, GL_UNSIGNED_BYTE, indices);
//glDrawArrays (GL_POLYGON, 0, 4);