Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GL/glut.h>
- #include <stdlib.h>
- void display(void)
- {
- glClear(GL_COLOR_BUFFER_BIT); //flush gl
- // glColor3f(1.0, 0.0, 0.0); //red
- //hexagon
- glBegin(GL_POLYGON);
- glColor3f(1.0, 0.0, 0.0); //red
- glVertex2i(40,80); //left
- glVertex2i(80,120); //LT
- glColor3f(0.0, 1.0, 0.0); //green
- glVertex2i(160,120); //RT
- glVertex2i(200,80); //Right
- glColor3f(0.0, 0.0, 1.0); //blue
- glVertex2i(160,40); //RB
- glVertex2i(80,40); //RL
- glEnd();
- glFlush(); //force immidiate display
- }
- int main(int argc,char *argv[])
- {
- glutInit(&argc,argv); //prepare glut
- glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); //set the display mode
- glutInitWindowSize (500, 500); //the size of the program window
- glutInitWindowPosition (100, 100); //initial position for the window
- glutCreateWindow ("points and lines"); //create window with a title
- glClearColor(255,255,255,0.0); //background color
- glMatrixMode (GL_PROJECTION); //2d envyronment
- gluOrtho2D (40.0, 200.0, 40.0, 120.0); //matrix dimensions
- glutDisplayFunc(display); //show thee actual program
- glutMainLoop();
- return EXIT_SUCCESS; //exit the program
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement