Due: Friday, Oct. 30, by 11:59pm
OBJECTIVE: This lab is just to get you to type in an OpenGl program and get it to run. Basically, it is intended to make sure everyone can submit a lab assignment that compiles and runs on the official class environment. Type in the code below, compile it, and run it. Notes:
|
//////////////////////////////////////////////////////// // CSE 581 - Autumn 2011 // Lab 1 // <your name here> // <your email address here> //////////////////////////////////////////////////////// #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include <GL/glut.h> #include <GL/gl.h> void display(void) { glClear(GL_COLOR_BUFFER_BIT); // the color will be cleared glBegin(GL_QUADS); // draw a quadrilateral glVertex2f(-0.75f, -0.75f); glVertex2f( 0.75f, -0.75f); glVertex2f( 0.75f, 0.75f); glVertex2f(-0.75f, 0.75f); glEnd(); glFlush(); // force exec of all OpenGl commands } int _tmain(int argc, char** argv) { glutInit(&argc, argv); // initialize glut glutCreateWindow("581 Lab1"); // create a windo glutDisplayFunc(display); // say what the 'display' func is glClearColor(1.0,0.5,0.0,0.5); // set the clear color glColor3f(0.0,1.0,0.0); // set the drawing color glutMainLoop(); return EXIT_SUCCESS; }