pgm -2 from OpenGL.GL import* from OpenGL.GLU import* from OpenGL.GLUT import* def init(): glMatrixMode(GL_PROJECTION) glLoadIdentity() gluOrtho2D(0,100,0,100) glClearColor(1.0,1.0,0.0,0.0) glClear(GL_COLOR_BUFFER_BIT) def draw(): #drawing separation lines glColor3f(0.5,0.5,0.5) glPointSize(10.0) glBegin(GL_LINES) glVertex2i(0,50) glVertex2i(100,50) glVertex2i(50,0) glVertex2i(50,100) glEnd() glFlush() #triangle glColor3f(0.0,0.0,0.0) glPointSize(10.0) glBegin(GL_POLYGON) glVertex2i(10,10) glVertex2i(40,10) glVertex2i(25,40) glEnd() glFlush() #square glColor3f(0.0,0.0,0.0) glPointSize(10.0) glBegin(GL_POLYGON) glVertex2i(10,60) glVertex2i(40,60) glVertex2i(40,90) glVertex2i(10,90) glEnd() glFlush() #rectangle glColor3f(0.0,0.0,0.0) glPointSize(10.0) glBegin(GL_POLYGON) glVertex2i(55,65) glVertex2i(95,65) glVertex2i(95,85) glVertex2i(55,85) glEnd() glFlush() #hexagon glColor3f(0.0,0.0,0.0) glPointSize(10.0) glBegin(GL_POLYGON) glVertex2i(65,15) glVertex2i(85,15) glVertex2i(95,25) glVertex2i(85,35) glVertex2i(65,35) glVertex2i(55,25) glEnd() glFlush() def main(): glutInit() glutInitWindowSize(500,500) glutCreateWindow(\"OpenGL Window\") glutDisplayFunc(draw) init() glutMainLoop()