TrabalhosGratuitos.com - Trabalhos, Monografias, Artigos, Exames, Resumos de livros, Dissertações
Pesquisar

Código Helicóptero - Computação Gráfica

Por:   •  16/9/2016  •  Pesquisas Acadêmicas  •  1.123 Palavras (5 Páginas)  •  192 Visualizações

Página 1 de 5

Código Helicóptero - Computação Gráfica

#include

#include

GLfloat tamanho=0.1, angulo=0, anguloCorpo = 0, hor=0, vert=0;

void Desenho(){

     glClear(GL_COLOR_BUFFER_BIT);

     glMatrixMode(GL_PROJECTION);

     glLoadIdentity();

     gluOrtho2D(-5,5,-5,5);

     //glMatrixMode(GL_MODELVIEW);

     //glLoadIdentity();

    glScalef(tamanho, tamanho, 0);     // Exemplo de escala

    glTranslatef(hor, vert, 0); // Exemplo de translação

    glRotatef(anguloCorpo, 0,0 , 1);

    glColor3f(1, 0, 0);

    glBegin(GL_POLYGON); //CORPO HELICOPTERO

        glVertex3f(-10, 0, 0);

        glVertex3f(-7,  3, 0);

        glVertex3f(-7,  3, 0);

        glVertex3f( 5,  3, 0);

        glVertex3f( 8, 0, 0);

        glVertex3f(8, 0, 0);

        glVertex3f(5, -3, 0);

        glVertex3f(-7, -3, 0);

        glVertex3f(-10, 0, 0);

    glEnd();

    glBegin(GL_QUADS); //CAUDA

        glVertex3f(7, 1, 0);

        glVertex3f(17, 1, 0);

        //glColor3f(1, 10, 1);

        glVertex3f( 17, -1, 0);

        glVertex3f( 7, -1, 0);

     glEnd();

     glBegin(GL_QUADS); //ASA CAUDA

        glVertex3f(14, 3.4, 0);

        glVertex3f(15.4, 3.4, 0);

       // glColor3f(1, 1, 1);

        glVertex3f( 15.4, -3.4, 0);

        glVertex3f( 14, -3.4, 0);

     glEnd();

    glRotatef(angulo, 0, 0, 1);// Exemplo de rotação

    glColor3f(0.67, 0.67, 0.67);

    glBegin(GL_POLYGON); //HELICES

    //glBegin(GL_LINE_LOOP); //HELICES

        glVertex3f(-1, 0, 0);

        glVertex3f(-10, 8, 0);

        glVertex3f(-8, 10, 0);

        glVertex3f(0, 1, 0);

        glVertex3f(7, 10, 0);

        glVertex3f(9, 9, 0);

        glVertex3f(1, 0, 0);

        glVertex3f(10, -9, 0);

        glVertex3f(9, -11, 0);

        glVertex3f(0, -1, 0);

        glVertex3f(-8, -11, 0);

        glVertex3f(-10, -10, 0);

        glVertex3f(-1, 0, 0);

    glEnd();

     glutSwapBuffers();

}

void Teclas(unsigned char tecla, GLint x, GLint y){

     switch(tecla){

         case '+': tamanho++;

                   break;

         case '-': tamanho--;

                   break;

     }

     Desenho();

}

void Setas(GLint tecla, GLint x, GLint y){

...

Baixar como (para membros premium)  txt (3.5 Kb)   pdf (55.8 Kb)   docx (10.5 Kb)  
Continuar por mais 4 páginas »
Disponível apenas no TrabalhosGratuitos.com