Say I have this array:
Code: Select all
static float CubeFace_Top[12] = {
-1, 1, -1,
-1, 1, 1,
1, 1, 1,
1, 1, -1
};
Code: Select all
for ( int x = 0;x < 8;x++ )
{
for ( int z = 0;z < 8;z++ )
{
glPushMatrix();
glTranslatef((float)x, 0, (float)-z);
glBegin(GL_QUADS);
glVertex3f(CubeFace_Top[0], CubeFace_Top[1], CubeFace_Top[2]);
glVertex3f(CubeFace_Top[3], CubeFace_Top[4], CubeFace_Top[5]);
glVertex3f(CubeFace_Top[6], CubeFace_Top[7], CubeFace_Top[8]);
glVertex3f(CubeFace_Top[9], CubeFace_Top[10], CubeFace_Top[11]);
glEnd();
glPopMatrix();
}
}
Well, yes it works just fine.
But if I set the polygons raster mode to GL_LINE via glPolygonMode().
Then here is the result:
This isn't anything I haven't encountered before, but it is usually caused by submitting a number of vertices that can't be equally divided by 4 (for quads anyway).
Anyone takers? I've tried everything I can think of, I originally thought I was setting up the vertex arrays wrong but the screenshot was rendered using the immediate mode as shown in the code.
I'm sure I'm missing something obvious, I literally sent 2 hours figuring out why depth sorting wasn't working yesterday when I hadn't enabled depth testing
Thanks!