//glut display function void display(void) { glClear(GL_COLOR_BUFFER_BIT); // Draw all the points glColor3f(1.0, 0.0, 0.0); for (int x=0; x<numPoints; x++) polyPoint[x].draw(); // Draw the polgon if (initializeComplete) { glColor3f(0.0, 0.0, 1.0); glBegin(GL_LINE_LOOP); for (int x=0; x<numPoints; x++) glVertex2f(polyPoint[x].getX(), polyPoint[x].getY()); glEnd(); } // Draw the test point, and the text saying whether it's inside or outside. if (firstPointDrawn) { char inside[] = "The point drawn is INSIDE the polygon."; char outside[] = "The point drawn is OUTSIDE the polygon."; glColor3f(0.0, 1.0, 0.0); testPoint.draw(); char* dispText = (pointInside) ? inside : outside; glRasterPos2i(100,100); for (int x=0; x< strlen(dispText); x++) glutBitmapCharacter(GLUT_BITMAP_8_BY_13, dispText[x]); } glutSwapBuffers();