Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<windows.h>
- #include <GL/glut.h>
- #include <stdlib.h>
- void init()
- {
- glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
- glOrtho(-15,10,-5,10,-5,5);
- }
- void myDisplay()
- {
- glClear(GL_COLOR_BUFFER_BIT);
- glColor3f(0.0f, 1.0f, 0.0f);
- glColor3f(1.0f, 0.0f, 0.0f);
- glColor3f(0.0f, 0.0f, 1.0f);
- /*glBegin(GL_QUADS); // DRAWING 4 SIDED QUADRILATERAL
- glVertex2d(-2.0,-4.0);
- glVertex2d(4.0,-2.0);
- glVertex2d(4.0,2.0);
- glVertex2d(-2.0,4.0);
- glEnd();*/
- glBegin(GL_TRIANGLES); // DRAWING 3 SIDED TRIANGLE
- // Set 6
- glColor3f(0.44f, 0.52f, 0.50f); glVertex2d(0,0); //3rd
- glColor3f(1.0f, 1.0f, 1.0f); glVertex2d(6,0); //2nd
- glColor3f(0.464f, 0.531f, 0.597f); glVertex2d(0,2); // 1st
- glColor3f(0.44f, 0.52f, 0.50f); glVertex2d(0,0); //3rd
- glColor3f(1.0f, 1.0f, 1.0f); glVertex2d(-6,0); //2nd
- glColor3f(0.464f, 0.531f, 0.597f); glVertex2d(0,2); // 1st
- //------Set 5
- glColor3f(0.44f, 0.52f, 0.50f); glVertex2d(0,0); //3rd
- glColor3f(1.0f, 1.0f, 1.0f); glVertex2d(5,0); //2nd
- glColor3f(0.464f, 0.531f, 0.597f); glVertex2d(0,3); // 1st
- glColor3f(0.44f, 0.52f, 0.50f); glVertex2d(0,0); //3rd
- glColor3f(1.0f, 1.0f, 1.0f); glVertex2d(-5,0); //2nd
- glColor3f(0.464f, 0.531f, 0.597f); glVertex2d(0,3); // 1st
- //-----Set 4--------------------------------------------------------------
- glColor3f(0.44f, 0.52f, 0.50f); glVertex2d(0,0); //3rd
- glColor3f(1.0f, 1.0f, 1.0f); glVertex2d(4,0); //2nd
- glColor3f(0.464f, 0.531f, 0.597f); glVertex2d(0,5); // 1st
- glColor3f(0.44f, 0.52f, 0.50f); glVertex2d(0,0); //3rd
- glColor3f(1.0f, 1.0f, 1.0f); glVertex2d(-4,0); //2nd
- glColor3f(0.464f, 0.531f, 0.597f); glVertex2d(0,5); // 1st
- //------Set 3---------------------------------------------------------------
- glColor3f(0.44f, 0.52f, 0.50f); glVertex2d(0,0); //3rd
- glColor3f(1.0f, 1.0f, 1.0f); glVertex2d(3,0); //2nd
- glColor3f(0.464f, 0.531f, 0.597f); glVertex2d(0,7); // 1st
- glColor3f(0.44f, 0.52f, 0.50f); glVertex2d(0,0); //3rd
- glColor3f(1.0f, 1.0f, 1.0f); glVertex2d(-3,0); //2nd
- glColor3f(0.464f, 0.531f, 0.597f); glVertex2d(0,7); // 1st
- //-----Set 2-----------------------------------------------------
- glColor3f(0.44f, 0.52f, 0.50f); glVertex2d(0,0); //3rd
- glColor3f(1.0f, 1.0f, 1.0f); glVertex2d(2,0); //2nd
- glColor3f(0.464f, 0.531f, 0.597f); glVertex2d(0,8.7); // 1st
- glColor3f(0.44f, 0.52f, 0.50f); glVertex2d(0,0); //3rd
- glColor3f(1.0f, 1.0f, 1.0f); glVertex2d(-2,0); //2nd
- glColor3f(0.464f, 0.531f, 0.597f); glVertex2d(0,8.7); // 1st
- //-----SET 1------------------------------------------------------
- glColor3f(0.44f, 0.52f, 0.50f); glVertex2d(0,1); //3rd
- glColor3f(1.0f, 1.0f, 1.0f); glVertex2d(1,0); //2nd
- glColor3f(0.464f, 0.531f, 0.597f); glVertex2d(0,10); // 1st
- glColor3f(0.44f, 0.52f, 0.50f); glVertex2d(0,1); //3rd
- glColor3f(0.464f, 0.531f, 0.597f); glVertex2d(0,10);// 1st
- glColor3f(1.0f, 1.0f, 1.0f); glVertex2d(-1,0); //2nd
- //----------------------------------------------------------------------------
- glEnd();
- glBegin(GL_QUADS);
- glVertex2d(0,1); //3rd
- glVertex2d(-10,0);// 1st
- glVertex2d(5,-0); //2nd
- glVertex2d(-10,-5);
- glEnd();
- */
- glFlush();
- }
- int main()
- {
- glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
- glutInitWindowSize(600, 450);
- glutInitWindowPosition(100, 100);
- glutCreateWindow("Raffid_011152053");
- init();
- glutDisplayFunc(myDisplay);
- glutMainLoop();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement