SHARE
TWEET

Untitled

a guest Aug 12th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void CCandyStick::draw()
  2. {
  3.     glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
  4.     glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
  5.  
  6.     glPushMatrix();
  7.     glTranslatef(-2.2, -1.0, 1.7);
  8.     glTranslatef(0.0, 0.5, 0.0);
  9.    
  10.     // ========================
  11.     // = Question 2 (a)       =
  12.     // = Draw the candy stick =
  13.     // ========================
  14.     // Insert missing code
  15.  
  16.     for (int i=0;i<NUM_CIRCUMFERENTIAL_VERTICES_CANDYSTICK;i++) {
  17.         glBegin(GL_QUAD_STRIP);
  18.         for (int j=0;j<NUM_LONGITUDINAL_VERTICES_CANDYSTICK;j++) {
  19.             double t = (double) (j+1) / (double)NUM_CIRCUMFERENTIAL_VERTICES_CANDYSTICK;
  20.             //glNormal3f(normals[i][j][0],normals[i][j][1],normals[i][j][2]);
  21.             glVertex3d(vertices[i][j][0],vertices[i][j][1],vertices[i][j][2]);
  22.            
  23.             //glNormal3f(normals[i][j][0],normals[i][j][1],normals[i+1][j][2]);
  24.             glVertex3d(vertices2[i][j][0],vertices2[i][j][1],vertices2[i][j][2]);
  25.  
  26.        
  27.         }
  28.         glEnd();
  29.     }
  30.  
  31.    
  32.  
  33.     glPopMatrix();
  34.     glFlush();
  35. }
RAW Paste Data
Top