Tarea Humanoide | Diana Vargas

#include <windows.h>
#include <GL/glut.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

float angulo=0;
void display(void)
{
    glClear( GL_COLOR_BUFFER_BIT );
    glColor3f(0.0, 0.0, 0.0);

    glPushMatrix();
    glRotatef(angulo+2, 0, 1, 0);
    //HEAD
    glPushMatrix();
    glTranslatef(0,1.8,0);
    glScalef(1.5,0.7,1);
    glutWireSphere(1,20,20);
    glPopMatrix();

    //BODY
    glPushMatrix();
    glTranslatef(0,-1.2,0);
    glScalef(2,1.5,1.5);

    glutWireSphere(1,20,20);
    glPopMatrix();

    glPushMatrix();
    glTranslatef(0,0.5,0);
    glScalef(1.6,0.6,1);
    glutWireSphere(1,20,20);

    glPopMatrix();

    // PIE DER
    glPushMatrix();
    glTranslatef(0.6,-2.8,0);
    glScalef(1.1,1.3,1);
    glutWireSphere(0.5,20,20);
    glPopMatrix();

    // PIE IZQ
    glPushMatrix();
    glTranslatef(-0.6,-2.8,0);
    glScalef(1.1,1.3,1);
    glutWireSphere(0.5,20,20);
    glPopMatrix();

     // BRAZO
    glPushMatrix();
    glTranslatef(1.9,-0.5,0);
    glScalef(1.1,2.5,1);
    glutWireSphere(0.5,20,20);
    glPopMatrix();

    // EL OTRO BRAZO
    glPushMatrix();
    glTranslatef(-1.9,-0.5,0);
    glScalef(-1.1,2.5,1);
    glutWireSphere(0.5,20,20);
    glPopMatrix();


    glPopMatrix();

    //OJO IZQ
    glPushMatrix();
    glColor3f(0, 0, 0);
    glTranslatef(-0.5,1.8,0);
    glutSolidSphere(0.2,20,20);
    glPopMatrix();

    //OJO DER
    glPushMatrix();
    glColor3f(0, 0, 0);
    glTranslatef(0.5,1.8,0);
    glutSolidSphere(0.2,20,20);
    glPopMatrix();


    glutSwapBuffers();
}
void idle(void) {
    angulo=angulo+0.1;
    glutPostRedisplay();
}
int main(int argc, char **argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    glutInitWindowSize(600, 600);
    glutCreateWindow("Baymax <3");

    glClearColor(1.0, 1.0, 1.0, 1.0);
    glOrtho(-3.5, 3.5, -3.5, 3.5, -3.5, 3.5);

    glutDisplayFunc(display);
    glutIdleFunc(idle);
    glutMainLoop();
    return 0;
}


Comentarios

Entradas populares de este blog

Código Capitán América Diana Vargas

Reflejo | Diana Vargas

Cámara | Israel González de la Peña