Advertisement
sohag_cse

Lab Task - 02 (182-15-2164-PC-A)

Oct 2nd, 2021
1,056
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <GL/glut.h>
  2. #include <stdio.h>
  3. #include <GL/gl.h>
  4.  
  5. void init(void)
  6. {
  7.   glClearColor(0, 0, 0,0.0);
  8.   glMatrixMode(GL_PROJECTION);
  9.   glLoadIdentity();
  10.   gluOrtho2D(0.0,500.0,0.0,500.0);
  11. }
  12.  
  13. void display(){
  14.     glClear(GL_COLOR_BUFFER_BIT);
  15.  
  16.     //Finland Flag
  17.     glColor3f(0.968, 0.968, 0.968);
  18.     glBegin(GL_QUADS);
  19.  
  20.     glVertex2d(100,200);
  21.     glVertex2d(400,200);
  22.     glVertex2d(400,400);
  23.     glVertex2d(100,400);
  24.  
  25.     glColor3f(0, 0.2, 0.486);
  26.     glVertex2d(180,200);
  27.     glVertex2d(227,200);
  28.     glVertex2d(227,400);
  29.     glVertex2d(180,400);
  30.  
  31.     glVertex2d(100,273);
  32.     glVertex2d(400,273);
  33.     glVertex2d(400,327);
  34.     glVertex2d(100,327);
  35.  
  36.     glEnd();
  37.  
  38.     glFlush();
  39.     glutSwapBuffers();
  40. }
  41.  
  42. int main(int argc,char **argv){
  43.  
  44.     glutInit(&argc,argv);
  45.     glutInitDisplayMode ( GLUT_RGB | GLUT_DOUBLE );
  46.  
  47.     glutInitWindowPosition(0,0);
  48.     glutInitWindowSize(500,500);
  49.     glutCreateWindow("Sohag Raha - 182-15-2164");
  50.  
  51.     init();
  52.     glutDisplayFunc(display);
  53.     glutMainLoop();
  54.     return 0;
  55. }
  56.  
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement