Printing points and edges on a grid.

Hi,

Any help is good.

I am trying to print out a triangle with a dot in the center on a grid based on the example function.
I have to implement the display function so it can show on the grid whatever its on the example function.

I am having a hard time on the “i” variable being not 0 at the beginning of my for loop. What did I do wrong ?

I dont see anything! but still not working.

The example func is as follows:

void example(void) {
//First click so store point0 (-1, -1) but no edge
points[numberPoints][0] = -1;
points[numberPoints][1] = -1;
numberPoints++;

//left click so store point1 (0, 1) and edge0 that connects point0 and point1
points[numberPoints][0] = 0;
points[numberPoints][1] = 1;
previousPointSubscript = numberPoints;
edges[numberEdges][0] = previousPointSubscript;
edges[numberEdges][1] = numberPoints-1;
numberEdges++;
numberPoints++;

//left click so store point2 (1, -1) and edge1 that connects point1 and point2
points[numberPoints][0] = 1;
points[numberPoints][1] = -1;
previousPointSubscript = numberPoints;
edges[numberEdges][0] = previousPointSubscript;
edges[numberEdges][1] = numberPoints-1;
numberEdges++;
numberPoints++;

//Point3 has been left clicked but a linear search of the points array shows it
//is actually a duplicate of Point0. Do not store the duplicate but point to it.
duplicatePointSubscript = 0;
edges[numberEdges][0] = previousPointSubscript;
edges[numberEdges][1] = duplicatePointSubscript;
numberEdges++;

//Right click so store point3 (0, 0) but no edge
points[numberPoints][0] = 0;
points[numberPoints][1] = 0;
//previousPointSubscript = numberPoints; //not needed here
numberPoints++;

} //end of example

my display function so far is:

static void display(void)

{
example();
glClear(GL_COLOR_BUFFER_BIT);

	//Replace this indented code by code to make a grid of lines       (pgm 1)
	//Use loops controlled by the width and height constant variables 

			glColor3f(BLACK);
			glBegin(GL_LINES);
			
			int i = 0;
			int point1;
			int point2;
			
			
		/*	for (int i = 0; i <= numberEdges; i++);
			{
				point1 = edges[i][0];
				point2 = edges [i][1];
			}
			vertex2f[points[point]];				

*/
glColor3f(BLACK);
glBegin(GL_POINTS);

			for (int i = 0; i <= numberPoints; i++);
			{
				point1 = points[i][0];
				point2 = points[i][1];
				glVertex2f(point1, point2);
			}
			

			
			
			glEnd();//end drawing of points



			
			
			glEnd();


			if (showGrid)
			{
			
			glColor3f(LIGHT_GRAY); 
			glBegin(GL_LINES);	// Toggle maker		

			
			for (i = -maxXValue; i <= maxXValue; i++) // Horizontal(X) lines loop
			{
				glVertex2f(-maxXValue, i); glVertex2f(maxXValue, i);					
			}

			for (i = -maxYValue; i <= maxYValue; i++)
			{
				glVertex2f(i, -maxYValue); glVertex2f(i, maxYValue); // Vertical(Y) lines loop
			}
			

			glEnd(); 

			glColor3f(RED); // Line maker
			glBegin(GL_LINES);

				glVertex2f(-maxXValue, 0); // Horizontal red line
				glVertex2f(maxXValue, 0);
				glVertex2f(0, -maxYValue); // Vertical red line
				glVertex2f(0, maxYValue);						
			
			

			glEnd();
					
			}
				
glFlush();

// Swap The Buffers To make Our Rendering Visible
glutSwapBuffers ( );				

}//end of display function*******************************************************
I am codding in C++ using Visual C++

Please help!

Specifically in am having a problem in the loop :

for (int i = 0; i <= numberPoints; i++);
{
point1 = points[i][0];
point2 = points[i][1];
glVertex2f(point1, point2);
}

numberPoints and numberEdges ae initialized = 0 at the beginning of example function