Making a maze using arrays

Basically I am trying to make a maze in OpenGL. The problem I am having is that I am using array lists for the maze map but it doesn’t create the shape I want. The code is below:

float wallX[13] = {25, 15, 35, 55, 45, 45, 65, 15, 65, 55, 45, 35, 25}; //Array for columns
float wallY[26] = {10, 25, 15, 45, 15, 35, 15, 45, 15, 25, 35, 55, 35, 45, 55, 75, 55, 75, 65, 75, 65, 85, 75, 85, 95, 105}; //Array for what part of the columns are coloured, each pair is a line
float pi = 0;
int WallXCo = 0;
int WallYCo = 0;
float WallXCo1;
float WallXCo2;
float WallYCo1;
float WallYCo2;
for(pi = 0; pi < 13; pi++)
{
	WallXCo1 = wallX[WallXCo] - 1.25;
	WallXCo2 = wallX[WallXCo] + 1.25;
	WallYCo1 = (wallY[WallYCo] - 1.25) * -1;
	WallYCo2 = (wallY[WallYCo + 1] + 1.25)*-1;
	drawWall(WallXCo1, WallYCo1, WallXCo2, WallYCo2);
	WallXCo = WallXCo + 1;
	WallYCo = WallYCo + 2;
}
 void drawWall(float WallXCo1, float WallYCo1, float WallYCo2, float WallXCo2)
{
	glColor3f(1,0,1);
	glBegin(GL_POLYGON);
	glVertex2f((WallXCo1),(WallYCo1));
	glVertex2f((WallXCo2),(WallYCo1));
	glVertex2f((WallXCo2),(WallYCo2));
	glVertex2f((WallXCo1),(WallYCo2));
	glEnd();
}

This is just the code for the vertical sections of the map. Each X coordinate has two Y coordinates (WallX[0] equates to wallY[0] and wallY[1] making a line 5 in width between the two points).

However instead of any sort of map coming out of it I just get a mass of green with no shape. Anyone know what I am doing wrong?


That is what it looks like, the pink is what is generated by the above code.

Anyone know why it is doing this? It is really annoying me.

Anyone? I have tested each bit of the code and it outputs the numbers correctly and draws a square correctly yet won’t do it all together.

Aside from hurting the eyes with pink/green colors, I do not understand what is your problem.

How do you expect it to look like ?

Colours are only there till I texture it.

The idea was to have lines, like the first one would go from 23.75 to 26.25 across and from -8.5 to -26.75 down (using one number from WallX and two from wallY).