Guest User

Untitled

a guest
Apr 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. // The purpose of this function is to draw the objects to the screen
  2. void Draw()
  3. {
  4.     glMatrixMode(GL_PROJECTION); // set the view volume shape
  5.     glLoadIdentity();
  6.     glOrtho(-worldx, worldx, -worldy, worldy, 0.1, 100);
  7.  
  8.     glMatrixMode(GL_MODELVIEW); // position and aim the camera
  9.     glLoadIdentity();
  10.    
  11.     gluLookAt(eyeX, eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ);
  12.  
  13.     // Check if user inputs 'i' or 'I' from the keyboard
  14.     if (original)
  15.     {
  16.         OriginalView();
  17.         original = false;
  18.     }
  19.    
  20.  
  21.     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the screen
  22.     for (int i=0; i<37; i++)
  23.     {
  24.         GLfloat mat_ambient[] = {0.0, 0.5, 0.8, 1.0 };
  25.         glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
  26.         cancer.DrawNormalCell(cancer.v[i].x,cancer.v[i].y,cancer.v[i].z);
  27.     }
  28.  
  29.     if (drawCancer)
  30.     {
  31.         for (int i=0; i<37; i++)
  32.         {
  33.             GLfloat mat_ambient[] = {0.8, 0.0, 0.2, 1.0 };
  34.             glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
  35.             cancer.DrawCancerCell(cancer.v[19].x,cancer.v[19].y,cancer.v[19].z);
  36.     }
  37.    
  38.     glutSwapBuffers();
  39. }
Add Comment
Please, Sign In to add comment