jueves, 11 de octubre de 2012

Programa de Transformaciones II unidad



#include <GL/glut.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);

    glTranslatef(-2.0, -2.0, 0.0);
    glColor3f(0.0f, 1.0f, 1.0f);
    glBegin(GL_POLYGON);
        glVertex3f (2.0, 2.0,0.0);
        glVertex3f (7.0, 2.0,0.0);
        glVertex3f (7.0, 7.0,0.0);
        glVertex3f (2.0, 7.0,0.0);
    glEnd();
    glFlush ();
}

void init (void)
{
    glClearColor (1.f,1.0,0.1,0.f);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-3.0, 6.0, -2.0, 6.0, -5.0, 5.0);
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize (250, 250);
    glutInitWindowPosition (100, 100);
    glutCreateWindow ("Traslacion Fernandez");
    init ();
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}
_________________________________________________________________________________


#include <GL/glut.h>

void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
    glScalef(0.5, 0.5, 0.0);
    glColor3f(0.0f, 1.0f, 1.0f);
    glBegin(GL_POLYGON);
        glVertex3f (2.0, 2.0,0.0);
        glVertex3f (7.0, 2.0,0.0);
        glVertex3f (7.0, 7.0,0.0);
        glVertex3f (2.0, 7.0,0.0);
    glEnd();
    glFlush ();
}

void init (void)
{
    glClearColor (1.f,1.0,0.1,0.f);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-3.0, 6.0, -2.0, 6.0, -5.0, 5.0);
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize (250, 250);
    glutInitWindowPosition (100, 100);
    glutCreateWindow ("Traslacion Fernandez");
    init ();
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
 }
_________________________________________________________________________________



#include <GL/glut.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
    glRotatef(45.0, 0.0, 0.0,1.0);
    glColor3f(0.0f, 1.0f, 1.0f);
    glBegin(GL_POLYGON);
        glVertex2f (2.0, 2.0);
        glVertex2f (7.0, 2.0);
        glVertex2f (7.0, 7.0);
        glVertex2f (2.0, 7.0);
    glEnd();
    glFlush ();
}

void init (void)
{
    glClearColor (1.f,1.0,0.1,0.f);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
  glOrtho(-4.0, 6.0, 12.0, -1.0, -4.0, 9);
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize (250, 250);
    glutInitWindowPosition (100, 100);
    glutCreateWindow ("Rotacion Fernandez");
    init ();
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}
_________________________________________________________________________________

#include <GL/glut.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);

    
    glColor3f(0.0f, 1.0f, 1.0f);
    glBegin(GL_POLYGON);
        glVertex3f (2.0, 2.0,0.0);
        glVertex3f (7.0, 2.0,0.0);
        glVertex3f (7.0, 7.0,0.0);
        glVertex3f (2.0, 7.0,0.0); 
    glEnd();

glTranslatef(-2.0, -2.0, 0.0);
    glColor3f(1.0f, 1.0f, 1.f);
    glBegin(GL_POLYGON);
        glVertex3f (2.0, 2.0,0.0);
        glVertex3f (7.0, 2.0,0.0);
        glVertex3f (7.0, 7.0,0.0);
        glVertex3f (2.0, 7.0,0.0); 
    glEnd();

    glFlush ();
}

void init (void)
{
    glClearColor (1.f,1.0,0.1,0.f);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-1.0, 9.0, -2.0, 8.0, -8.0, 8.0);
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize (250, 250);
    glutInitWindowPosition (100, 100);
    glutCreateWindow ("Traslacion Fernandez");
    init ();
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}
________________________________________________________________________________



#include <GL/glut.h>

void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
 
   glColor3f(0.0f, 0.0f, 0.);
    glBegin(GL_POLYGON);
        glVertex3f (0.0, 0.0,0.0);
        glVertex3f (5.0, 0.0,0.0);
        glVertex3f (5.0, 5.0,0.0);
        glVertex3f (0.0, 5.0,0.0);
    glEnd();


    glScalef(0.5, 0.5, 0.0);
   glColor3f(1.0f, 1.0f, 1.f);
    glBegin(GL_POLYGON);
        glVertex3f (0.0, 0.0,0.0);
        glVertex3f (5.0, 0.0,0.0);
        glVertex3f (5.0, 5.0,0.0);
        glVertex3f (0.0, 5.0,0.0);
    glEnd();

    glFlush ();
}

void init (void)
{
    glClearColor (0.f,1.0,0.1,0.f);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-3.0, 6.0, -2.0, 6.0, -5.0, 5.0);
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize (250, 250);
    glutInitWindowPosition (100, 100);
    glutCreateWindow ("Traslacion Fernandez");
    init ();
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
 }
_________________________________________________________________________________


#include <GL/glut.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
   
    glColor3f(0.0f, 1.0f, 1.0);
    glBegin(GL_POLYGON);
        glVertex2f (0.0, 0.0);
        glVertex2f (2.5, 0.0);
        glVertex2f (2.5, 2.5);
        glVertex2f (0.0, 2.5);
    glEnd();

glRotatef(45.0, 0.0, 0.0,1.0);
    glColor3f(1.0f, 1.0f, 1.0);
    glBegin(GL_POLYGON);
        glVertex2f (0.0, 0.0);
        glVertex2f (2.5, 0.0);
        glVertex2f (2.5, 2.5);
        glVertex2f (0.0, 2.5);
    glEnd();
    glFlush ();

    glFlush ();
}

void init (void)
{
    glClearColor (1.f,1.0,0.1,0.f);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
  glOrtho(-4.0, 6.0, 12.0, -1.0, -4.0, 9);
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize (250, 250);
    glutInitWindowPosition (100, 100);
    glutCreateWindow ("Rotacion Fernandez");
    init ();
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}
_________________________________________________________________________________



#include <GL/glut.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);

    
    glColor3f(0.0f, 1.0f, 1.0f);
    glBegin(GL_POLYGON);
        glVertex3f (2.0, 2.0,0.0);
        glVertex3f (7.0, 2.0,0.0);
        glVertex3f (7.0, 7.0,0.0);
        glVertex3f (2.0, 7.0,0.0); 
    glEnd();

glTranslatef(-2.0, -2.0, 0.0);
    glColor3f(1.0f, 1.0f, 1.f);
    glBegin(GL_POLYGON);
        glVertex3f (2.0, 2.0,0.0);
        glVertex3f (7.0, 2.0,0.0);
        glVertex3f (7.0, 7.0,0.0);
        glVertex3f (2.0, 7.0,0.0); 
    glEnd();



glScalef(0.5, 0.5, 0.0);
   glColor3f(0.0f, 1.0f, -1.f);
    glBegin(GL_POLYGON);
        glVertex3f (2.0, 2.0,0.0);
        glVertex3f (7.0, 2.0,0.0);
        glVertex3f (7.0, 7.0,0.0);
        glVertex3f (2.0, 7.0,0.0);
    glEnd();



glRotatef(45.0, 0.0, 0.0,1.0);
    glColor3f(-1.0f,-1.0f,-1.0f);
    glBegin(GL_POLYGON);
      glVertex3f (2.0, 2.0,0.0);
        glVertex3f (7.0, 2.0,0.0);
        glVertex3f (7.0, 7.0,0.0);
        glVertex3f (2.0, 7.0,0.0);
    glEnd();





    glFlush ();
}

void init (void)
{
    glClearColor (1.f,1.0,0.1,0.f);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-4.0, 9.0, -2.0, 8.0, -8.0, 8.0);
}

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize (250, 250);
    glutInitWindowPosition (100, 100);
    glutCreateWindow ("Traslacion Fernandez");
    init ();
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}


No hay comentarios:

Publicar un comentario