Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. /* origem do corpo */
  2. glTranslatef(0.0, 0.0, 0.0);
  3. glTranslatef(posXcorpo, posYcorpo, posZcorpo);
  4. glPushMatrix();
  5. glScalef(2.0, 2.0, 1.5);
  6. glutWireCube(1.0);
  7. glPopMatrix();
  8.  
  9. /* origem da cabeca */
  10. glTranslatef(0.0, -0.15, 0.0);
  11. glRotatef((GLfloat)cabeca, 0.0, 1.0, 0.0);
  12. glTranslatef(0.0, 1.5, 0.0);
  13. glPushMatrix();
  14. glScalef(2.4, 2.4, 1.0);
  15. glutWireCube(0.3);
  16. glPopMatrix();
  17.  
  18. /* origem da ombro direito */
  19. glTranslatef(1.25, -2.3, 0.2);
  20. glTranslatef(0.0, 1.5, 0.0);
  21. glPushMatrix();
  22. glScalef(1.0, 1.0, 1.0);
  23. glutSolidSphere(0.3,20,20);
  24. glPopMatrix();
  25.  
  26. /* origem volta para o sistema de coordenadas original */
  27. glPopMatrix();
  28. glutSwapBuffers();
  29. }
  30.  
  31. void reshape(int w, int h) {
  32. glViewport(0, 0, (GLsizei)w, (GLsizei)h);
  33. glMatrixMode(GL_PROJECTION);
  34. glLoadIdentity();
  35. gluPerspective(65.0, (GLfloat)w / (GLfloat)h, 1.0, 20.0);
  36. glMatrixMode(GL_MODELVIEW);
  37. glLoadIdentity();
  38. glTranslatef(0.0, 0.0, -5.0);
  39. }
  40.  
  41. void keyboard(unsigned char key, int x, int y) {
  42. switch (key) {
  43. case 'x':
  44. posXcorpo = (posXcorpo + 1) % 360;
  45. glutPostRedisplay();
  46. break;
  47. case 'X':
  48. posXcorpo = (posXcorpo - 1) % 360;
  49. glutPostRedisplay();
  50. break;
  51. case 'z':
  52. posZcorpo = (posZcorpo + 1) % 360;
  53. glutPostRedisplay();
  54. break;
  55. case 'Z':
  56. posZcorpo = (posZcorpo - 1) % 360;
  57. glutPostRedisplay();
  58. break;
  59. case 'y':
  60. posYcorpo = (posYcorpo + 1) % 360;
  61. glutPostRedisplay();
  62. break;
  63. case 'Y':
  64. posYcorpo = (posYcorpo - 1) % 360;
  65. glutPostRedisplay();
  66. break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement