#include<stdio.h>
#include<GL/glut.h>
void myInit(){
glClearColor(1.0,1.0,1.0,1.0);
glColor3f(0.0,0.0,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,10.0,0.0,10.0);
glMatrixMode(GL_MODELVIEW);
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glPointSize(4.0);
glBegin(GL_POLYGON);
glVertex2f(3.0,6.0);
//glColor3f(0.0,1.0,0.0);
glVertex2f(7.0,6.0);
//glColor3f(0.0,0.0,1.0);
glVertex2f(5.0,8.0);
//glColor3f(1.0,1.0,0.0);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0,0.0,0.0);
glVertex2f(3.0,6.0);
glVertex2f(3.0,2.0);
glVertex2f(7.0,2.0);
glVertex2f(7.0,6.0);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0,0.0,0.0);
glVertex2f(3.5,5.5);
glVertex2f(3.5,4.6);
glVertex2f(4.5,4.6);
glVertex2f(4.5,5.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0,0.0,0.0);
glVertex2f(3.5+2.0,5.5);
glVertex2f(3.5+2.0,4.6);
glVertex2f(2.0+4.5,4.6);
glVertex2f(4.5+2.0,5.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0,1.0,1.0);
glVertex2f(1.5+3.0,4.0);
glVertex2f(1.5+3.0,2.0+0.155);
glVertex2f(1.5+4.0,2.0+0.155);
glVertex2f(1.5+4.0,4.0);
glEnd();
glFlush();
glEnd();
}
int main(int argc,char **argv){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowSize(500,500);
glutInitWindowPosition(100,100);
glutCreateWindow("My First Example");
glutDisplayFunc(display);
myInit();
glutMainLoop();
return 0;
}