Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.30 KB | None | 0 0
  1. void DrawScene()
  2. {
  3.    
  4.     glClear(GL_COLOR_BUFFER_BIT);
  5.  
  6.     glBegin(GL_QUADS);
  7.    
  8.     double wsp_max=100.0f;
  9.    
  10.     glColor3f(1.0f, 1.0f, 1.0f);
  11.     glVertex2f(-wsp_max, -wsp_max);
  12.     //glColor3f(0.0f, 1.0f, 1.0f);
  13.     glVertex2f(-wsp_max, wsp_max);
  14.     //glColor3f(1.0f, 0.0f, 1.0f);
  15.     glVertex2f(wsp_max, wsp_max);
  16.     //glColor3f(0.0f, 1.0f, 1.0f);
  17.     glVertex2f(wsp_max, -wsp_max);
  18.  
  19.     glColor3f(0.0f, 0.0f, 0.0f);
  20.     glVertex2f(-wsp_max/3, -wsp_max/3);
  21.     //glColor3f(0.0f, 0.0f, 0.0f);
  22.     glVertex2f(-wsp_max/3, wsp_max/3);
  23.     //glColor3f(0.0f, 0.0f, 1.0f);
  24.     glVertex2f(wsp_max/3, wsp_max/3);
  25.     //glColor3f(0.0f, 0.0f, 1.0f);
  26.     glVertex2f(wsp_max/3, -wsp_max/3);
  27.    
  28.     double p;
  29.     p=2*wsp_max/3;
  30.     double s=1.f;
  31.     s=2*wsp_max/9;
  32.     double x;
  33.     double y;
  34.    
  35.     for(int i =0; i<4; i++)
  36.     {  
  37.         for(x=0; x<2*wsp_max; x=x+3*s)
  38.         {  
  39.             for(y=0; y<2*wsp_max; y=y+3*s)
  40.             {                      
  41.                 //glBegin(GL_QUADS);
  42.                 //glColor3f(0.0f, 1.0f, 0.0f);
  43.                 glVertex2f(-wsp_max+p/3+x, -wsp_max+p/3+y);
  44.                 //glColor3f(1.0f, 0.0f, 0.0f);
  45.                 glVertex2f(-wsp_max+p/3+x, -wsp_max+p/3+s+y);
  46.                 //glColor3f(1.0f, 0.0f, 1.0f);
  47.                 glVertex2f(-wsp_max+p/3+s+x, -wsp_max+p/3+s+y);
  48.                 //glColor3f(0.0f, 1.0f, 0.0f);
  49.                 glVertex2f(-wsp_max+p/3+s+x, -wsp_max+p/3+y);
  50.                 //glEnd();
  51.            
  52.             }              
  53.         }  
  54.         s/=3;
  55.         p/=3;  
  56.     }
  57.     glEnd();
  58.     glFlush();
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement