codigo
#include <GL/glut.h>
GLfloat arx = 0.0f;
GLfloat ary = 0.0f;
void reshape(int width, int height){
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-40,40,-40,40,-40,40);
glMatrixMode(GL_MODELVIEW);
}
void DibujaCaras(void)
{
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,1.0f);// azul
glVertex3f(-9.8,9.8,9.8);
glVertex3f(-3.8,9.8,9.8);
glVertex3f(-3.8,3.8,9.8);
glVertex3f(-9.8,3.8,9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.5f, 0.0f, 1.0f); //morado
glVertex3f(-9.8,9.8,3.8);
glVertex3f(-9.8,9.8,9.8);
glVertex3f(-9.8,3.8,9.8);
glVertex3f(-9.8,3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f, 1.0f, 0.0f); // verde
glVertex3f(-9.8,9.8,3.8);
glVertex3f(-9.8,9.8,9.8);
glVertex3f(-3.8,9.8,9.8);
glVertex3f(-3.8,9.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,1.0f);// azul
glVertex3f(-3.5,9.8,9.8);
glVertex3f(3.5,9.8,9.8);
glVertex3f(3.5,3.8,9.8);
glVertex3f(-3.5,3.8,9.8);
glEnd();
glBegin(GL_POLYGON);//
glColor3f(0.0f, 1.0f, 0.0f); // verde
glVertex3f(-3.5,9.8,3.8);
glVertex3f(-3.5,9.8,9.8);
glVertex3f(3.5,9.8,9.8);
glVertex3f(3.5,9.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,1.0f);// azul
glVertex3f(3.8,9.8,9.8);
glVertex3f(9.8,9.8,9.8);
glVertex3f(9.8,3.8,9.8);
glVertex3f(3.8,3.8,9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f, 1.0f, 0.0f); // verde
glVertex3f(3.8,9.8,3.8);
glVertex3f(3.8,9.8,9.8);
glVertex3f(9.8,9.8,9.8);
glVertex3f(9.8,9.8,3.8);
glEnd();
glBegin(GL_POLYGON);//
glColor3f(1.0f, 0.0f, 0.0f); // rojo
glVertex3f(9.8,9.8,3.8);
glVertex3f(9.8,9.8,9.8);
glVertex3f(9.8,3.8,9.8);
glVertex3f(9.8,3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,1.0f);// azul
glVertex3f(-9.8,3.5,9.8);
glVertex3f(-3.8,3.5,9.8);
glVertex3f(-3.8,-3.5,9.8);
glVertex3f(-9.8,-3.5,9.8);
glEnd();
glBegin(GL_POLYGON);//
glColor3f(0.5f, 0.0f, 1.0f); //morado
glVertex3f(-9.8,3.5,3.8);
glVertex3f(-9.8,3.5,9.8);
glVertex3f(-9.8,-3.5,9.8);
glVertex3f(-9.8,-3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,1.0f);// azul
glVertex3f(-3.5,3.5,9.8);
glVertex3f(3.5,3.5,9.8);
glVertex3f(3.5,-3.5,9.8);
glVertex3f(-3.5,-3.5,9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,1.0f);// azul
glVertex3f(3.8,3.5,9.8);
glVertex3f(9.8,3.5,9.8);
glVertex3f(9.8,-3.5,9.8);
glVertex3f(3.8,-3.5,9.8);
glEnd();
glBegin(GL_POLYGON);//
glColor3f(1.0f, 0.0f, 0.0f); // rojo
glVertex3f(9.8,3.5,3.8);
glVertex3f(9.8,3.5,9.8);
glVertex3f(9.8,-3.5,9.8);
glVertex3f(9.8,-3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,1.0f);// azul
glVertex3f(-9.8,-3.8,9.8);
glVertex3f(-3.8,-3.8,9.8);
glVertex3f(-3.8,-9.8,9.8);
glVertex3f(-9.8,-9.8,9.8);
glEnd();
glBegin(GL_POLYGON);//
glColor3f(0.5f, 0.0f, 1.0f); //morado
glVertex3f(-9.8,-3.8,3.8);
glVertex3f(-9.8,-3.8,9.8);
glVertex3f(-9.8,-9.8,9.8);
glVertex3f(-9.8,-9.8,3.8);
glEnd();
glBegin(GL_POLYGON);//
glColor3f(1.0f,1.0f,1.0f);//blanco
glVertex3f(-3.8,-9.8,3.8);
glVertex3f(-3.8,-9.8,9.8);
glVertex3f(-9.8,-9.8,9.8);
glVertex3f(-9.8,-9.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,1.0f);// azul
glVertex3f(-3.5,-3.8,9.8);
glVertex3f(3.5,-3.8,9.8);
glVertex3f(3.5,-9.8,9.8);
glVertex3f(-3.5,-9.8,9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f,1.0f,1.0f);//blanco
glVertex3f(3.5,-9.8,3.8);
glVertex3f(3.5,-9.8,9.8);
glVertex3f(-3.5,-9.8,9.8);
glVertex3f(-3.5,-9.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,1.0f);// azul
glVertex3f(3.8,-3.8,9.8);
glVertex3f(9.8,-3.8,9.8);
glVertex3f(9.8,-9.8,9.8);
glVertex3f(3.8,-9.8,9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f, 0.0f, 0.0f); // rojo
glVertex3f(9.8,-3.8,3.8);
glVertex3f(9.8,-3.8,9.8);
glVertex3f(9.8,-9.8,9.8);
glVertex3f(9.8,-9.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f,1.0f,1.0f);//blanco
glVertex3f(9.8,-9.8,3.8);
glVertex3f(9.8,-9.8,9.8);
glVertex3f(3.8,-9.8,9.8);
glVertex3f(3.8,-9.8,3.8);
glEnd();
//1c-i
glBegin(GL_POLYGON);
glColor3f(0.5f, 0.0f, 1.0f); //morado
glVertex3f(-9.8,9.8,-3.5);
glVertex3f(-9.8,9.8,3.5);
glVertex3f(-9.8,3.8,3.5);
glVertex3f(-9.8,3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f, 1.0f, 0.0f); // verde
glVertex3f(-9.8,9.8,-3.5);
glVertex3f(-9.8,9.8,3.5);
glVertex3f(-3.8,9.8,3.5);
glVertex3f(-3.8,9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f, 1.0f, 0.0f); // verde
glVertex3f(-3.5,9.8,-3.5);
glVertex3f(-3.5,9.8,3.5);
glVertex3f(3.5,9.8,3.5);
glVertex3f(3.5,9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f, 1.0f, 0.0f); // verde
glVertex3f(3.8,9.8,-3.5);
glVertex3f(3.8,9.8,3.5);
glVertex3f(9.8,9.8,3.5);
glVertex3f(9.8,9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f, 0.0f, 0.0f); // rojo
glVertex3f(9.8,9.8,-3.5);
glVertex3f(9.8,9.8,3.5);
glVertex3f(9.8,3.8,3.5);
glVertex3f(9.8,3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.5f, 0.0f, 1.0f); //morado
glVertex3f(-9.8,3.5,-3.5);
glVertex3f(-9.8,3.5,3.5);
glVertex3f(-9.8,-3.5,3.5);
glVertex3f(-9.8,-3.5,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f, 0.0f, 0.0f); // rojo
glVertex3f(9.8,3.5,-3.5);
glVertex3f(9.8,3.5,3.5);
glVertex3f(9.8,-3.5,3.5);
glVertex3f(9.8,-3.5,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.5f, 0.0f, 1.0f); //morado
glVertex3f(-9.8,-3.8,-3.5);
glVertex3f(-9.8,-3.8,3.5);
glVertex3f(-9.8,-9.8,3.5);
glVertex3f(-9.8,-9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f,1.0f,1.0f);//blanco
glVertex3f(-3.8,-9.8,-3.5);
glVertex3f(-3.8,-9.8,3.5);
glVertex3f(-9.8,-9.8,3.5);
glVertex3f(-9.8,-9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f,1.0f,1.0f);//blanco
glVertex3f(3.5,-9.8,-3.5);
glVertex3f(3.5,-9.8,3.5);
glVertex3f(-3.5,-9.8,3.5);
glVertex3f(-3.5,-9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f, 0.0f, 0.0f); // rojo
glVertex3f(9.8,-3.8,-3.5);
glVertex3f(9.8,-3.8,3.5);
glVertex3f(9.8,-9.8,3.5);
glVertex3f(9.8,-9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f,1.0f,1.0f);//blanco
glVertex3f(9.8,-9.8,-3.5);
glVertex3f(9.8,-9.8,3.5);
glVertex3f(3.8,-9.8,3.5);
glVertex3f(3.8,-9.8,-3.5);
glEnd();
//1-i
glBegin(GL_POLYGON);
glColor3f(1.0f, 1.0f, 0.0f); // amarillo
glVertex3f(-9.8,9.8,-9.8);
glVertex3f(-3.8,9.8,-9.8);
glVertex3f(-3.8,3.8,-9.8);
glVertex3f(-9.8,3.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.5f, 0.0f, 1.0f); //morado
glVertex3f(-9.8,9.8,-9.8);
glVertex3f(-9.8,9.8,-3.8);
glVertex3f(-9.8,3.8,-3.8);
glVertex3f(-9.8,3.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f, 1.0f, 0.0f); // verde
glVertex3f(-9.8,9.8,-9.8);
glVertex3f(-9.8,9.8,-3.8);
glVertex3f(-3.8,9.8,-3.8);
glVertex3f(-3.8,9.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f, 1.0f, 0.0f); // amarillo
glVertex3f(-3.5,9.8,-9.8);
glVertex3f(3.5,9.8,-9.8);
glVertex3f(3.5,3.8,-9.8);
glVertex3f(-3.5,3.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f, 1.0f, 0.0f); // verde
glVertex3f(-3.5,9.8,-9.8);
glVertex3f(-3.5,9.8,-3.8);
glVertex3f(3.5,9.8,-3.8);
glVertex3f(3.5,9.8,-9.8);
glEnd();
//1-d
glBegin(GL_POLYGON);
glColor3f(1.0f, 1.0f, 0.0f); // amarillo
glVertex3f(3.8,9.8,-9.8);
glVertex3f(9.8,9.8,-9.8);
glVertex3f(9.8,3.8,-9.8);
glVertex3f(3.8,3.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f, 1.0f, 0.0f); // verde
glVertex3f(3.8,9.8,-9.8);
glVertex3f(3.8,9.8,-3.8);
glVertex3f(9.8,9.8,-3.8);
glVertex3f(9.8,9.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f, 0.0f, 0.0f); // rojo
glVertex3f(9.8,9.8,-9.8);
glVertex3f(9.8,9.8,-3.8);
glVertex3f(9.8,3.8,-3.8);
glVertex3f(9.8,3.8,-9.8);
glEnd();
//2i
glBegin(GL_POLYGON);
glColor3f(1.0f, 1.0f, 0.0f); // amarillo
glVertex3f(-9.8,3.5,-9.8);
glVertex3f(-3.8,3.5,-9.8);
glVertex3f(-3.8,-3.5,-9.8);
glVertex3f(-9.8,-3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.5f, 0.0f, 1.0f); //morado
glVertex3f(-9.8,3.5,-9.8);
glVertex3f(-9.8,3.5,-3.8);
glVertex3f(-9.8,-3.5,-3.8);
glVertex3f(-9.8,-3.5,-9.8);
glEnd();
//2c
glBegin(GL_POLYGON);
glColor3f(1.0f, 1.0f, 0.0f); // amarillo
glVertex3f(-3.5,3.5,-9.8);
glVertex3f(3.5,3.5,-9.8);
glVertex3f(3.5,-3.5,-9.8);
glVertex3f(-3.5,-3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f, 1.0f, 0.0f);
glVertex3f(3.8,3.5,-9.8);
glVertex3f(9.8,3.5,-9.8);
glVertex3f(9.8,-3.5,-9.8);
glVertex3f(3.8,-3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f, 0.0f, 0.0f); // rojo
glVertex3f(9.8,3.5,-9.8);
glVertex3f(9.8,3.5,-3.8);
glVertex3f(9.8,-3.5,-3.8);
glVertex3f(9.8,-3.5,-9.8);
glEnd();
//3i
glBegin(GL_POLYGON);
glColor3f(1.0f, 1.0f, 0.0f); // amarillo
glVertex3f(-9.8,-3.8,-9.8);
glVertex3f(-3.8,-3.8,-9.8);
glVertex3f(-3.8,-9.8,-9.8);
glVertex3f(-9.8,-9.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.5f, 0.0f, 1.0f); //morado
glVertex3f(-9.8,-3.8,-9.8);
glVertex3f(-9.8,-3.8,-3.8);
glVertex3f(-9.8,-9.8,-3.8);
glVertex3f(-9.8,-9.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f,1.0f,1.0f);//blanco
glVertex3f(-3.8,-9.8,-9.8);
glVertex3f(-3.8,-9.8,-3.8);
glVertex3f(-9.8,-9.8,-3.8);
glVertex3f(-9.8,-9.8,-9.8);
glEnd();
//3c
glBegin(GL_POLYGON);
glColor3f(1.0f, 1.0f, 0.0f); // amarillo
glVertex3f(-3.5,-3.8,-9.8);
glVertex3f(3.5,-3.8,-9.8);
glVertex3f(3.5,-9.8,-9.8);
glVertex3f(-3.5,-9.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f,1.0f,1.0f);//blanco
glVertex3f(3.5,-9.8,-9.8);
glVertex3f(3.5,-9.8,-3.8);
glVertex3f(-3.5,-9.8,-3.8);
glVertex3f(-3.5,-9.8,-9.8);
glEnd();
//3d
glBegin(GL_POLYGON);
glColor3f(1.0f, 1.0f, 0.0f); // amarillo
glVertex3f(3.8,-3.8,-9.8);
glVertex3f(9.8,-3.8,-9.8);
glVertex3f(9.8,-9.8,-9.8);
glVertex3f(3.8,-9.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f, 0.0f, 0.0f); // rojo
glVertex3f(9.8,-3.8,-9.8);
glVertex3f(9.8,-3.8,-3.8);
glVertex3f(9.8,-9.8,-3.8);
glVertex3f(9.8,-9.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(1.0f,1.0f,1.0f);//blanco
glVertex3f(9.8,-9.8,-9.8);
glVertex3f(9.8,-9.8,-3.8);
glVertex3f(3.8,-9.8,-3.8);
glVertex3f(3.8,-9.8,-9.8);
glEnd();
//--------------------------------------------------------------- Relleno
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-9.8,9.8,3.8);
glVertex3f(-3.8,9.8,3.8);
glVertex3f(-3.8,3.8,3.8);
glVertex3f(-9.8,3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-3.8,9.8,3.8);
glVertex3f(-3.8,9.8,9.8);
glVertex3f(-3.8,3.8,9.8);
glVertex3f(-3.8,3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-3.5,9.8,2.8);
glVertex3f(-3.5,9.8,9.8);
glVertex3f(-3.5,9.8,9.8);
glVertex3f(-3.5,3.8,2.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(3.5,9.8,3.8);
glVertex3f(3.5,9.8,9.8);
glVertex3f(3.5,3.8,9.8);
glVertex3f(3.5,3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(3.8,9.8,3.8);
glVertex3f(3.8,9.8,9.8);
glVertex3f(3.8,3.8,9.8);
glVertex3f(3.8,3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(9.8,3.8,3.8);
glVertex3f(9.8,3.8,9.8);
glVertex3f(3.8,3.8,9.8);
glVertex3f(3.8,3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-9.8,3.5,3.8);
glVertex3f(-9.8,3.5,9.8);
glVertex3f(-3.8,3.5,9.8);
glVertex3f(-3.8,3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-3.5,3.5,3.8);
glVertex3f(-3.5,3.5,9.8);
glVertex3f(-3.5,-3.5,9.8);
glVertex3f(-3.5,-3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(3.8,3.5,3.8);
glVertex3f(3.8,3.5,9.8);
glVertex3f(3.8,-3.5,9.8);
glVertex3f(3.8,-3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(9.8,-3.5,3.8);
glVertex3f(9.8,-3.5,9.8);
glVertex3f(3.8,-3.5,9.8);
glVertex3f(3.8,-3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-9.8,-3.8,3.8);
glVertex3f(-9.8,-3.8,9.8);
glVertex3f(-3.8,-3.8,9.8);
glVertex3f(-3.8,-3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-3.5,-3.8,3.8);
glVertex3f(3.5,-3.8,3.8);
glVertex3f(3.5,-9.8,3.8);
glVertex3f(-3.5,-9.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-3.5,-3.8,3.8);
glVertex3f(-3.5,-3.8,9.8);
glVertex3f(-3.5,-9.8,9.8);
glVertex3f(-3.5,-9.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(3.8,-3.8,3.8);
glVertex3f(9.8,-3.8,3.8);
glVertex3f(9.8,-9.8,3.8);
glVertex3f(3.8,-9.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(3.8,-3.8,3.8);
glVertex3f(3.8,-3.8,9.8);
glVertex3f(3.8,-9.8,9.8);
glVertex3f(3.8,-9.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-9.8,9.8,-3.5);
glVertex3f(-3.8,9.8,-3.5);
glVertex3f(-3.8,3.8,-3.5);
glVertex3f(-9.8,3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-3.8,9.8,-3.5);
glVertex3f(-3.8,9.8,3.5);
glVertex3f(-3.8,3.8,3.5);
glVertex3f(-3.8,3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(3.5,9.8,-3.5);
glVertex3f(3.5,9.8,3.5);
glVertex3f(3.5,3.8,3.5);
glVertex3f(3.5,3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(9.8,3.8,-3.5);
glVertex3f(9.8,3.8,3.5);
glVertex3f(3.8,3.8,3.5);
glVertex3f(3.8,3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-9.8,3.5,-3.5);
glVertex3f(-9.8,3.5,3.5);
glVertex3f(-3.8,3.5,3.5);
glVertex3f(-3.8,3.5,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(9.8,-3.5,-3.5);
glVertex3f(9.8,-3.5,3.5);
glVertex3f(3.8,-3.5,3.5);
glVertex3f(3.8,-3.5,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-9.8,-3.8,-3.5);
glVertex3f(-9.8,-3.8,3.5);
glVertex3f(-3.8,-3.8,3.5);
glVertex3f(-3.8,-3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-3.5,-3.8,-3.5);
glVertex3f(3.5,-3.8,-3.5);
glVertex3f(3.5,-9.8,-3.5);
glVertex3f(-3.5,-9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(3.8,-3.8,-3.5);
glVertex3f(9.8,-3.8,-3.5);
glVertex3f(9.8,-9.8,-3.5);
glVertex3f(3.8,-9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-9.8,9.8,-3.8);
glVertex3f(-3.8,9.8,-3.8);
glVertex3f(-3.8,3.8,-3.8);
glVertex3f(-9.8,3.8,-3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-2.8,7.8,-7.8);
glVertex3f(-2.8,7.8,-2.8);
glVertex3f(-2.8,2.8,-2.8);
glVertex3f(-2.8,2.8,-7.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-3.5,9.8,-3.8);
glVertex3f(3.5,9.8,-3.8);
glVertex3f(3.5,3.8,-3.8);
glVertex3f(-3.5,3.8,-3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(3.5,9.8,-9.8);
glVertex3f(3.5,9.8,-3.8);
glVertex3f(3.5,3.8,-3.8);
glVertex3f(3.5,3.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(3.8,9.8,-3.8);
glVertex3f(9.8,9.8,-3.8);
glVertex3f(9.8,3.8,-3.8);
glVertex3f(3.8,3.8,-3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(9.8,3.8,-9.8);
glVertex3f(9.8,3.8,-3.8);
glVertex3f(3.8,3.8,-3.8);
glVertex3f(3.8,3.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-9.8,3.5,-3.8);
glVertex3f(-3.8,3.5,-3.8);
glVertex3f(-3.8,-3.5,-3.8);
glVertex3f(-9.8,-3.5,-3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-9.8,3.5,-9.8);
glVertex3f(-9.8,3.5,-3.8);
glVertex3f(-3.8,3.5,-3.8);
glVertex3f(-3.8,3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-3.5,3.5,-3.8);
glVertex3f(3.5,3.5,-3.8);
glVertex3f(3.5,-3.5,-3.8);
glVertex3f(-3.5,-3.5,-3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(3.8,3.5,-3.8);
glVertex3f(9.8,3.5,-3.8);
glVertex3f(9.8,-3.5,-3.8);
glVertex3f(3.8,-3.5,-3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(9.8,-3.5,-9.8);
glVertex3f(9.8,-3.5,-3.8);
glVertex3f(3.8,-3.5,-3.8);
glVertex3f(3.8,-3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-9.8,-3.8,-3.8);
glVertex3f(-3.8,-3.8,-3.8);
glVertex3f(-3.8,-9.8,-3.8);
glVertex3f(-9.8,-9.8,-3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-9.8,-3.8,-9.8);
glVertex3f(-9.8,-3.8,-3.8);
glVertex3f(-3.8,-3.8,-3.8);
glVertex3f(-3.8,-3.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(-3.5,-3.8,-3.8);
glVertex3f(3.5,-3.8,-3.8);
glVertex3f(3.5,-9.8,-3.8);
glVertex3f(-3.5,-9.8,-3.8);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.0f,0.0f,0.0f);
glVertex3f(3.8,-3.8,-3.8);
glVertex3f(9.8,-3.8,-3.8);
glVertex3f(9.8,-9.8,-3.8);
glVertex3f(3.8,-9.8,-3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.8,3.8,3.8);
glVertex3f(-3.8,3.8,9.8);
glVertex3f(-9.8,3.8,9.8);
glVertex3f(-9.8,3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,9.8,3.8);
glVertex3f(3.5,9.8,3.8);
glVertex3f(3.5,3.8,3.8);
glVertex3f(-3.5,3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.5,3.8,3.8);
glVertex3f(3.5,3.8,9.8);
glVertex3f(-3.5,3.8,9.8);
glVertex3f(-3.5,3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,9.8,3.8);
glVertex3f(9.8,9.8,3.8);
glVertex3f(9.8,3.8,3.8);
glVertex3f(3.8,3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-9.8,3.5,3.8);
glVertex3f(-3.8,3.5,3.8);
glVertex3f(-3.8,-3.5,3.8);
glVertex3f(-9.8,-3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.8,3.5,3.8);
glVertex3f(-3.8,3.5,9.8);
glVertex3f(-3.8,-3.5,9.8);
glVertex3f(-3.8,-3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.8,-3.5,3.8);
glVertex3f(-3.8,-3.5,9.8);
glVertex3f(-9.8,-3.5,9.8);
glVertex3f(-9.8,-3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,3.5,3.8);
glVertex3f(3.5,3.5,3.8);
glVertex3f(3.5,-3.5,3.8);
glVertex3f(-3.5,-3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,3.5,3.8);
glVertex3f(-3.5,3.5,9.8);
glVertex3f(3.5,3.5,9.8);
glVertex3f(3.5,3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.5,3.5,3.8);
glVertex3f(3.5,3.5,9.8);
glVertex3f(3.5,-3.5,9.8);
glVertex3f(3.5,-3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.5,-3.5,3.8);
glVertex3f(3.5,-3.5,9.8);
glVertex3f(-3.5,-3.5,9.8);
glVertex3f(-3.5,-3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,3.5,3.8);
glVertex3f(9.8,3.5,3.8);
glVertex3f(9.8,-3.5,3.8);
glVertex3f(3.8,-3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,3.5,3.8);
glVertex3f(3.8,3.5,9.8);
glVertex3f(9.8,3.5,9.8);
glVertex3f(9.8,3.5,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-9.8,-3.8,3.8);
glVertex3f(-3.8,-3.8,3.8);
glVertex3f(-3.8,-9.8,3.8);
glVertex3f(-9.8,-9.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.8,-3.8,3.8);
glVertex3f(-3.8,-3.8,9.8);
glVertex3f(-3.8,-9.8,9.8);
glVertex3f(-3.8,-9.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,-3.8,3.8);
glVertex3f(-3.5,-3.8,9.8);
glVertex3f(3.5,-3.8,9.8);
glVertex3f(3.5,-3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.5,-3.8,3.8);
glVertex3f(3.5,-3.8,9.8);
glVertex3f(3.5,-9.8,9.8);
glVertex3f(3.5,-9.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,-3.8,3.8);
glVertex3f(3.8,-3.8,9.8);
glVertex3f(9.8,-3.8,9.8);
glVertex3f(9.8,-3.8,3.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-9.8,9.8,3.5);
glVertex3f(-3.8,9.8,3.5);
glVertex3f(-3.8,3.8,3.5);
glVertex3f(-9.8,3.8,3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.8,3.8,-3.5);
glVertex3f(-3.8,3.8,3.5);
glVertex3f(-9.8,3.8,3.5);
glVertex3f(-9.8,3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,9.8,-3.5);
glVertex3f(3.5,9.8,-3.5);
glVertex3f(3.5,3.8,-3.5);
glVertex3f(-3.5,3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,9.8,3.5);
glVertex3f(3.5,9.8,3.5);
glVertex3f(3.5,3.8,3.5);
glVertex3f(-3.5,3.8,3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,9.8,-3.5);
glVertex3f(-3.5,9.8,3.5);
glVertex3f(-3.5,3.8,3.5);
glVertex3f(-3.5,3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.5,3.8,-3.5);
glVertex3f(3.5,3.8,3.5);
glVertex3f(-3.5,3.8,3.5);
glVertex3f(-3.5,3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,9.8,-3.5);
glVertex3f(9.8,9.8,-3.5);
glVertex3f(9.8,3.8,-3.5);
glVertex3f(3.8,3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,9.8,3.5);
glVertex3f(9.8,9.8,3.5);
glVertex3f(9.8,3.8,3.5);
glVertex3f(3.8,3.8,3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,9.8,-3.5);
glVertex3f(3.8,9.8,3.5);
glVertex3f(3.8,3.8,3.5);
glVertex3f(3.8,3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-9.8,3.5,-3.5);
glVertex3f(-3.8,3.5,-3.5);
glVertex3f(-3.8,-3.5,-3.5);
glVertex3f(-9.8,-3.5,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-9.8,3.5,3.5);
glVertex3f(-3.8,3.5,3.5);
glVertex3f(-3.8,-3.5,3.5);
glVertex3f(-9.8,-3.5,3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,3.5,-3.5);
glVertex3f(9.8,3.5,-3.5);
glVertex3f(9.8,-3.5,-3.5);
glVertex3f(3.8,-3.5,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,3.5,3.5);
glVertex3f(9.8,3.5,3.5);
glVertex3f(9.8,-3.5,3.5);
glVertex3f(2.8,-3.5,3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,3.5,-3.5);
glVertex3f(3.8,3.5,3.5);
glVertex3f(3.8,-3.5,3.5);
glVertex3f(3.8,-3.5,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-9.8,-3.8,-3.5);
glVertex3f(-3.8,-3.8,-3.5);
glVertex3f(-3.8,-9.8,-3.5);
glVertex3f(-9.8,-9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-9.8,-3.8,3.5);
glVertex3f(-3.8,-3.8,3.5);
glVertex3f(-3.8,-9.8,3.5);
glVertex3f(-9.8,-9.8,3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.8,-3.8,-3.5);
glVertex3f(-3.8,-3.8,3.5);
glVertex3f(-3.8,-9.8,3.5);
glVertex3f(-3.8,-9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,-3.8,3.5);
glVertex3f(3.5,-3.8,3.5);
glVertex3f(3.5,-9.8,3.5);
glVertex3f(-3.5,-9.8,3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,-3.8,-3.5);
glVertex3f(-3.5,-3.8,3.5);
glVertex3f(-3.5,-9.8,3.5);
glVertex3f(-3.5,-9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,-3.8,-3.5);
glVertex3f(-3.5,-3.8,3.5);
glVertex3f(3.5,-3.8,3.5);
glVertex3f(3.5,-3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.5,-3.8,-3.5);
glVertex3f(3.5,-3.8,3.5);
glVertex3f(3.5,-9.8,3.5);
glVertex3f(3.5,-9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,-3.8,3.5);
glVertex3f(9.8,-3.8,3.5);
glVertex3f(9.8,-9.8,3.5);
glVertex3f(3.8,-9.8,3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,-3.8,-3.5);
glVertex3f(3.8,-3.8,3.5);
glVertex3f(3.8,-9.8,3.5);
glVertex3f(3.8,-9.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,-3.8,-3.5);
glVertex3f(3.8,-3.8,3.5);
glVertex3f(9.8,-3.8,3.5);
glVertex3f(9.8,-3.8,-3.5);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.8,3.8,-9.8);
glVertex3f(-3.8,3.8,-3.8);
glVertex3f(-9.8,3.8,-3.8);
glVertex3f(-9.8,3.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,9.8,-9.8);
glVertex3f(-3.5,9.8,-3.8);
glVertex3f(-3.5,3.8,-3.8);
glVertex3f(-3.5,3.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.5,3.8,-9.8);
glVertex3f(3.5,3.8,-3.8);
glVertex3f(-3.5,3.8,-3.8);
glVertex3f(-3.5,3.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,9.8,-9.8);
glVertex3f(3.8,9.8,-3.8);
glVertex3f(3.8,3.8,-3.8);
glVertex3f(3.8,3.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.8,3.5,-9.8);
glVertex3f(-3.8,3.5,-3.8);
glVertex3f(-3.8,-3.5,-3.8);
glVertex3f(-3.8,-3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.8,-3.5,-9.8);
glVertex3f(-3.8,-3.5,-3.8);
glVertex3f(-9.8,-3.5,-3.8);
glVertex3f(-9.8,-3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,3.5,-9.8);
glVertex3f(-3.5,3.5,-3.8);
glVertex3f(-3.5,-3.5,-3.8);
glVertex3f(-3.5,-3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,3.5,-9.8);
glVertex3f(-3.5,3.5,-3.8);
glVertex3f(3.5,3.5,-3.8);
glVertex3f(3.5,3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.5,3.5,-9.8);
glVertex3f(3.5,3.5,-3.8);
glVertex3f(3.5,-3.5,-3.8);
glVertex3f(3.5,-3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.5,-3.5,-9.8);
glVertex3f(3.5,-3.5,-3.8);
glVertex3f(-3.5,-3.5,-3.8);
glVertex3f(-3.5,-3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,3.5,-9.8);
glVertex3f(3.8,3.5,-3.8);
glVertex3f(3.8,-3.5,-3.8);
glVertex3f(3.8,-3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,3.5,-9.8);
glVertex3f(3.8,3.5,-3.8);
glVertex3f(9.8,3.5,-3.8);
glVertex3f(9.8,3.5,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.8,-3.8,-9.8);
glVertex3f(-3.8,-3.8,-3.8);
glVertex3f(-3.8,-9.8,-3.8);
glVertex3f(-3.8,-9.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,-3.8,-9.8);
glVertex3f(-3.5,-3.8,-3.8);
glVertex3f(-3.5,-9.8,-3.8);
glVertex3f(-3.5,-9.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(-3.5,-3.8,-9.8);
glVertex3f(-3.5,-3.8,-3.8);
glVertex3f(3.5,-3.8,-3.8);
glVertex3f(3.5,-3.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.5,-3.8,-9.8);
glVertex3f(3.5,-3.8,-3.8);
glVertex3f(3.5,-9.8,-3.8);
glVertex3f(3.5,-9.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,-3.8,-9.8);
glVertex3f(3.8,-3.8,-3.8);
glVertex3f(3.8,-9.8,-3.8);
glVertex3f(3.8,-9.8,-9.8);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(3.8,-3.8,-9.8);
glVertex3f(3.8,-3.8,-3.8);
glVertex3f(9.8,-3.8,-3.8);
glVertex3f(9.8,-3.8,-9.8);
glEnd();
}
void display(){
glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glRotatef(arx, 1.0f, 0.0f, 0.0f);
glRotatef(ary, 0.0f, 1.0f, 0.0f);
DibujaCaras();
glFlush();
glutSwapBuffers();
}
void init()
{
glClearColor(0,0,0,0);
glEnable(GL_DEPTH_TEST);
}
void idle()
{
display();
}
void Teclado(int key, int x, int y){
switch (key){
case GLUT_KEY_UP:arx-=30.00f;
break;
case GLUT_KEY_DOWN:arx+=30.00f;
break;
case GLUT_KEY_RIGHT:ary+=30.00f;
break;
case GLUT_KEY_LEFT:ary-=30.00f;
break;
}
switch (key) {
case 27:
exit(0);
break;
}
}
int main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB);
glutInitWindowPosition(400,200);
glutInitWindowSize(400,250);
glutCreateWindow("Ruben De La Cruz Venegas");
init();glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutIdleFunc(idle);
glutSpecialFunc(Teclado);
glutMainLoop();
return 0;}
capturas
No hay comentarios.:
Publicar un comentario