This is the drawing code:
Code:
void progDisplay (void)
{
/* Clear the redering window */
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
int i=0;
float x0,y0,x1,y1=0.0;
/* Draw a grid */
glColor3f (0.2, 0.2, 0.2);
for(i = 1; i < 60; i++) //vertical
{
drawLine (XMIN+i, YMAX, XMIN+i, YMIN);
}
for(i = 1; i < 40; i++) //horizontal
{
drawLine (XMIN, YMIN+i, XMAX, YMIN+i);
}
/* Pointless border. */
glColor3f (1.0, 1.0, 1.0);
drawLine (XMIN+2.0, YMIN+2.0, XMAX-2.0, YMIN+2.0);
drawLine (XMAX-2.0, YMIN+2.0, XMAX-2.0, YMAX-3.0);
drawLine (XMAX-2.0, YMAX-3.0, XMIN+2.0, YMAX-3.0);
drawLine (XMIN+2.0, YMAX-3.0, XMIN+2.0, YMIN+2.0);
/* Borders of the pinball machine. */
glColor3f (0.0, 0.0, 1.0);
drawLine (XMIN+3.0, YMIN+10.0, XMIN+3.0, YMAX-14.0); //Left Side (LS)
drawLine (XMIN+23.0, YMIN+10.0, XMIN+23.0, YMAX-14.0); //RS
drawLine (XMIN+3.0, YMIN+10.0, XMIN+9.0, YMIN+6.0); //BottemLeft (BL)
drawLine (XMIN+23.0, YMIN+10.0, XMIN+17.0, YMIN+6.0); //BottemLeft (BL)
drawCircle (13.0, 26.0, 10.0, 0.5); //Circled topshape (C)
/* Yellow text. */
glColor3f (1.0, 1.0, 0.0);
printText (XMIN+1.0, YMAX-2.0,
"Text.");
/* Flush the pipeline, and swap the buffers. */
glFlush ();
glutSwapBuffers();
/* Increase timestep */
t += 1;
printf("time : %d \n", t);
/* Request a re-draw for animation purposes */
glutPostRedisplay();
}
And this is in the main:
Code:
/* Initialization. */
glutInit (&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );//new
/* Initialization of the window. */
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (WINSIZE_X, WINSIZE_Y);
glutInitWindowPosition (WINPOS_X, WINPOS_Y);
/* Create the window. */
current_window = glutCreateWindow (FRAME_TITLE);
/* Initialize program. */
progInit ();
/* Stuff. */
//glutTimerFunc (0, progTimer, 0);
glutReshapeFunc (progReshape);
glutDisplayFunc (progDisplay);
//glutIdleFunc (progDisplay); /* not a clue what to do with this*/
glutKeyboardFunc (progKeyboard);
/* Event handling loop. */
glutMainLoop ();