Guest User

Untitled

a guest
Jun 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. void RenderBrain(void)
  2. {
  3.  
  4. glClear(GL_COLOR_BUFFER_BIT);
  5. glMatrixMode(GL_MODELVIEW);
  6.  
  7. ifstream myFile("brainData.txt");
  8.  
  9. if (!myFile.is_open())
  10. {
  11. cout << "Unable to open file";
  12. exit(1); // terminate with error
  13. }
  14.  
  15.  
  16. glRotatef(80.0f, 1.0f, 0.0f, 0.0f);
  17.  
  18. while (! myFile.eof())
  19. {
  20. myFile>>a[0];
  21. myFile>>a[1];
  22. myFile>>a[2];
  23. myFile>>a[3];
  24.  
  25.  
  26. glColor3f(0.60f,0.80f,0.90f);
  27.  
  28. glLoadIdentity();
  29. glTranslatef((a[0]-1.15)*26, a[2]*30, a[1]*30);
  30. glutSolidSphere(6, 5, 5);
  31.  
  32.  
  33. }
  34.  
  35. myFile.close();
  36. glFlush();
  37. glutSwapBuffers();
  38. }
  39.  
  40. glPushMatrix();
  41. glTranslatef((a[0]-1.15)*26, a[2]*30, a[1]*30);
  42. glutSolidSphere(6, 5, 5);
  43. glPopMatrix();
  44.  
  45. glMatrixMode(GL_MODELVIEW);
  46. glLoadIdentity();
  47. angle += angularVelocity * deltaTime;
  48. glRotate(angle, 1, 0, 0);
  49.  
  50. glLoadIdentity();
  51. glRotatef(80.0f, 1.0f, 0.0f, 0.0f);
  52. glTranslatef((a[0]-1.15)*26, a[2]*30, a[1]*30);
  53. glutSolidSphere(6, 5, 5);
Add Comment
Please, Sign In to add comment