SHARE
TWEET

Untitled

a guest Jan 15th, 2020 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void sfera()
  2. {
  3.     int j=0;
  4.     int i=0;
  5.     float slice_l = 180 / slice;
  6.     for (j=0; (j+1) * slice_l <= 180 ; j++)
  7.     {
  8.        
  9.         glColor3f(0, 1, 0);
  10.         glBegin(GL_TRIANGLE_STRIP);
  11.  
  12.        
  13.         glVertex3f(RI,0,0);
  14.         for (i=0; (i+1) * dAlfa <= 180; i++)
  15.         {
  16.            
  17.             {
  18.                 glVertex3f(RI * sin(DEG2RAD(i * dAlfa)), RI * cos(DEG2RAD(i * dAlfa)) * cos(DEG2RAD(j * slice_l)), RI * cos(DEG2RAD(i * dAlfa)) * sin(DEG2RAD(j * slice_l)));
  19.                 glVertex3f(RI * sin(DEG2RAD(i * dAlfa)), RI * cos(DEG2RAD(i * dAlfa)) * cos(DEG2RAD((j + 1) * slice_l)), RI * cos(DEG2RAD(i * dAlfa)) * sin(DEG2RAD((j + 1) * slice_l)));
  20.            
  21.                 glVertex3f(RI * sin(DEG2RAD((i+1) * dAlfa)), RI * cos(DEG2RAD((i+1) * dAlfa)) * cos(DEG2RAD(j * slice_l)), RI * cos(DEG2RAD((i+1) * dAlfa)) * sin(DEG2RAD(j * slice_l)));
  22.                 glVertex3f(RI * sin(DEG2RAD((i+1) * dAlfa)), RI * cos(DEG2RAD((i+1) * dAlfa)) * cos(DEG2RAD((j + 1) * slice_l)), RI * cos(DEG2RAD((i+1) * dAlfa)) * sin(DEG2RAD((j + 1) * slice_l)));
  23.             }
  24.         }
  25.         glEnd();
  26.     }
  27.     glColor3f(1, 0, 1);
  28.     glRotatef(-90, 1, 0, 90 );
  29.  
  30.     glBegin(GL_TRIANGLE_FAN);
  31.     glVertex3f(0, 0, 0);
  32.     i=0;
  33.     for (i=0; i * dAlfa <= 360; i++)
  34.     {
  35.         glVertex3f(RI * cos(DEG2RAD(i * dAlfa)), 0, RI * sin(DEG2RAD(i * dAlfa)));
  36.     }
  37.     glVertex3f(RI * cos(DEG2RAD(180)), 0, RI * sin(DEG2RAD(180)));
  38.     glEnd();
  39.    
  40.    
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top