Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* origem do corpo */
- glTranslatef(0.0, 0.0, 0.0);
- glTranslatef(posXcorpo, posYcorpo, posZcorpo);
- glPushMatrix();
- glScalef(2.0, 2.0, 1.5);
- glutWireCube(1.0);
- glPopMatrix();
- /* origem da cabeca */
- glTranslatef(0.0, -0.15, 0.0);
- glRotatef((GLfloat)cabeca, 0.0, 1.0, 0.0);
- glTranslatef(0.0, 1.5, 0.0);
- glPushMatrix();
- glScalef(2.4, 2.4, 1.0);
- glutWireCube(0.3);
- glPopMatrix();
- /* origem da ombro direito */
- glTranslatef(1.25, -2.3, 0.2);
- glTranslatef(0.0, 1.5, 0.0);
- glPushMatrix();
- glScalef(1.0, 1.0, 1.0);
- glutSolidSphere(0.3,20,20);
- glPopMatrix();
- /* origem volta para o sistema de coordenadas original */
- glPopMatrix();
- glutSwapBuffers();
- }
- void reshape(int w, int h) {
- glViewport(0, 0, (GLsizei)w, (GLsizei)h);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(65.0, (GLfloat)w / (GLfloat)h, 1.0, 20.0);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(0.0, 0.0, -5.0);
- }
- void keyboard(unsigned char key, int x, int y) {
- switch (key) {
- case 'x':
- posXcorpo = (posXcorpo + 1) % 360;
- glutPostRedisplay();
- break;
- case 'X':
- posXcorpo = (posXcorpo - 1) % 360;
- glutPostRedisplay();
- break;
- case 'z':
- posZcorpo = (posZcorpo + 1) % 360;
- glutPostRedisplay();
- break;
- case 'Z':
- posZcorpo = (posZcorpo - 1) % 360;
- glutPostRedisplay();
- break;
- case 'y':
- posYcorpo = (posYcorpo + 1) % 360;
- glutPostRedisplay();
- break;
- case 'Y':
- posYcorpo = (posYcorpo - 1) % 360;
- glutPostRedisplay();
- break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement