miércoles, 18 de septiembre de 2013

U2-ACT2-piramide 3d






codigo(solido)
#include <GL/glut.h>

void display(void)
{

glColor3f (0.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f (1.5, 0.0, 0.0);
glVertex3f (0.0, 0.0, 1.5);
glVertex3f (0.0, 5.0, 0.0);
glEnd();

glColor3f(0.60,0.5,0.70);
glBegin(GL_POLYGON);
glVertex3f (0.0, 0.0, 1.5);
glVertex3f (-1.5, 0.0, 0.0);
glVertex3f (0.0, 5.0, 0.0);
glEnd();

 glColor3f(1.0,0.0,0.0);
 glBegin(GL_POLYGON);
 glVertex3f (-1.5, 0.0, 0.0);
 glVertex3f (0.0, 0.0, -1.5);
 glVertex3f (0.0, 5.0, 0.0);
 glEnd();

 glColor3f(0.0,1.0,0.0);
 glBegin(GL_POLYGON);
 glVertex3f (1.5, 0.0, 0.0);
 glVertex3f (0.0, 0.0, -1.5);
 glVertex3f (0.0, 5.0, 0.0);
 glEnd();

 glColor3f(1.0,0.0,1.0);
 glBegin(GL_POLYGON);
 glVertex3f (1.5, 0.0, 0.0);
 glVertex3f (0.0, 0.0, 1.5);
 glVertex3f (-1.5, 0.0, 0.0);
 glVertex3f (0.0, 0.0, -1.5);
 glEnd();
 glFlush ();
}
void init (void)
{glOrtho(-2.0,2.0,-0.5,5.0,-2.5,5.0);}
int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize (400, 400);
    glutCreateWindow ("Ruben De La Cruz Venegas");
    init ();
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}




codigo(lineas)

#include <GL/glut.h>

void display(void)
{

glColor3f (0.0, 1.0, 1.0);
glBegin(GL_LINE_LOOP);//glBegin(GL_POLYGON);
glVertex3f (1.5, 0.0, 0.0);
glVertex3f (0.0, 0.0, 1.5);
glVertex3f (0.0, 5.0, 0.0);
glEnd();

glColor3f(0.60,0.5,0.70);
glBegin(GL_LINE_LOOP);//glBegin(GL_POLYGON);
glVertex3f (0.0, 0.0, 1.5);
glVertex3f (-1.5, 0.0, 0.0);
glVertex3f (0.0, 5.0, 0.0);
glEnd();

 glColor3f(1.0,0.0,0.0);
 glBegin(GL_LINE_LOOP);//glBegin(GL_POLYGON);
 glVertex3f (-1.5, 0.0, 0.0);
 glVertex3f (0.0, 0.0, -1.5);
 glVertex3f (0.0, 5.0, 0.0);
 glEnd();

 glColor3f(0.0,1.0,0.0);
 glBegin(GL_LINE_LOOP);//glBegin(GL_POLYGON);
 glVertex3f (1.5, 0.0, 0.0);
 glVertex3f (0.0, 0.0, -1.5);
 glVertex3f (0.0, 5.0, 0.0);
 glEnd();

 glColor3f(1.0,0.0,1.0);
 glBegin(GL_LINE_LOOP);//glBegin(GL_POLYGON);
 glVertex3f (1.5, 0.0, 0.0);
 glVertex3f (0.0, 0.0, 1.5);
 glVertex3f (-1.5, 0.0, 0.0);
 glVertex3f (0.0, 0.0, -1.5);
 glEnd();
 glFlush ();
}
void init (void)
{glOrtho(-2.0,2.0,-0.5,5.0,-2.5,5.0);}
int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize (400, 400);
    glutCreateWindow ("Ruben De La Cruz Venegas");
    init ();
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}

No hay comentarios.:

Publicar un comentario