// Computer Graphics - Amir Hesami // big_point.cpp #include /********************************************************** * Use the following stements under windows only **********************************************************/ #pragma comment(lib, "opengl32.lib") // Link OpenGL32.lib #pragma comment(lib, "glu32.lib") // Link Glu32.lib #pragma comment(lib, "glut32.lib") // Link Glut32.lib #pragma comment(linker, "/entry:\"mainCRTStartup\"" ) // set the entry point to be main() #pragma comment(linker, "/subsystem:\"Windows\"" ) // set the entry point to be main() void display(); void init( ); int main(int argc, char** argv) { //Initialize glut and specifies command line options glutInit(&argc, argv); //Initializes opreation's mode and coloring system glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); //Specifying the window's size glutInitWindowSize(500,500); //Specifying the window's position glutInitWindowPosition(100,100); //Create the window glutCreateWindow("Big Points"); //Calling the drawing function glutDisplayFunc(display); init(); //Runing the program glutMainLoop(); return 0; } void display() { //Clear the window glClear(GL_COLOR_BUFFER_BIT); //Set the drawing color to red glColor3f(1.0,0.0,0.0); glPointSize(4.0); //draw unit square polygon glBegin(GL_POINTS); glVertex2f(-0.5,-0.5); glVertex2f(-0.5,0.5); glVertex2f(0.5,0.5); glVertex2f(0.5,-0.5); glEnd(); //Flush the buffer glFlush(); } void init() { //Set the background color glClearColor(1.0,1.0,1.0,1.0); //Sets the mode of matrix operation glMatrixMode(GL_PROJECTION); //Initalizes the transformation matrix to Identity matrix glLoadIdentity(); //Viewing the image in the screen gluOrtho2D(-1.0,1.0,-1.0,1.0); }