// Include Directives #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> void init() { // Setting the Projection glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0, 1.0, 0.0, 1.0); glClearColor(0.0, 0.0, 0.6, 1.0); glColor3f(1.0, 1.0, 0.0); glLineWidth(5.0); } void display() { glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_LINE_LOOP); // Setting Vertices glVertex2d(0.05, 0.50); glVertex2d(0.50, 0.95); glVertex2d(0.95, 0.50); glVertex2d(0.50, 0.05); glEnd(); glFlush(); } int main(int argc, char **argv) { glutInit(&argc, argv); // Setting the Window glutInitWindowPosition(0, 0); glutInitWindowSize(500, 500); glutCreateWindow("Hello Line Loop World"); glutDisplayFunc(display); init(); glutMainLoop(); return 0; }