Professional Documents
Culture Documents
#include <GL/glut.h>
#else
#include <GL/glut.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
glMatrixMode(GL_MODELVIEW);
glLoadIdentity() ;
}
struct Point3f{
float x, y, z;
float u, v;
};
FILE *f;
char line[80];
char mode[15];
char trash[9];
int i,numMaterial;
void planetas(){
const double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;
const double a = t*90.0;
//SOL
glPushMatrix();
glColor3ub(255,255,0);
glTranslated(0,0,180);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(80,slices,stacks);
glPopMatrix();
//MERCURIO
glPushMatrix();
glColor3ub(144,100,15);
glTranslated(-130,0,150);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(10,slices,stacks);
glPopMatrix();
//VENUS
glPushMatrix();
glColor3ub(89,63,9);
glTranslated(150,0,150);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(30,slices,stacks);
glPopMatrix();
//TIERRA
glPushMatrix();
glColor3ub(23,52,255);
glTranslated(0,0,0);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(30,slices,stacks);
glPopMatrix();
//TIERRA
glPushMatrix();
glColor3ub(227,47,43);
glTranslated(100,0,300);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(30,slices,stacks);
glPopMatrix();
//ESTRELLAS
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(150,150,150);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(150,150,150);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(150,150,150);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 1
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(50,50,50);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 2
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(75,25,100);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 3
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(30,90,70);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 4
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(120,70,30);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 5
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(80,20,80);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 6
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(110,90,10);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 7
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(10,30,120);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 8
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(60,40,90);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 9
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(100,100,100);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 10
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(70,10,50);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 11
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(20,50,80);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 12
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(90,30,20);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 13
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(40,70,60);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 14
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(60,80,40);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 15
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(90,90,60);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 16
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(10,20,70);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 17
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(80,80,80);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 18
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(50,30,70);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 19
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(20,80,20);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 20
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(70,70,10);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 21
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(10,10,10);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 22
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(90,90,90);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 23
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(20,40,60);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 24
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(30,70,100);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 25
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(80,20,40);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 1
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(50,50,50);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 2
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(75,25,100);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 3
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(30,90,70);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 4
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(120,70,30);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 5
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(80,20,80);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 6
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(110,90,10);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 7
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(10,30,120);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 8
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(60,40,90);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 9
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(100,100,100);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 10
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(70,10,50);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 11
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(20,50,80);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 12
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(90,30,20);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 13
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(40,70,60);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 14
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(60,80,40);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 15
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(90,90,60);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 16
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(10,20,70);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 17
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(80,80,80);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 18
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(50,30,70);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 19
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(20,80,20);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 20
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(70,70,10);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 21
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(10,10,10);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 22
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(90,90,90);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 23
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(20,40,60);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 24
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(30,70,100);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 25
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(80,20,40);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 26
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(60,10,70);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 27
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-70,60,30);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 28
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(40,10,90);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 29
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-20,60,-50);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 30
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(70,-30,60);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// ... Continuar con las estructuras 31 a 100 con coordenadas diferentes ...
// Estructura 31
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(50,90,20);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 32
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(30,-50,70);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 33
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(80,80,-20);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 34
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(10,-40,90);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 35
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(60,-60,60);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// ... Continuar con las estructuras 36 a 100 con coordenadas diferentes ...
// Estructura 36
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(30,-10,60);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 37
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-70,20,100);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 38
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(20,-70,40);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 39
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(40,30,80);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 40
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(80,60,-20);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// ... Continuar con las estructuras 41 a 100 con coordenadas diferentes ...
// Estructura 41
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-50,-50,-50);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 42
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-75,-25,-100);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 43
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-30,-90,-70);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 44
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-120,-70,-30);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 45
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-80,-20,-80);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 46
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-110,-90,-10);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 47
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-10,-30,-120);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 48
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-60,-40,-90);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 49
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-100,-100,-100);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// Estructura 50
glPushMatrix();
glColor3ub(255,255,255);
glTranslated(-70,-10,-50);
glRotated(60,1,0,0);
glRotated(a,0,0,1);
glutSolidSphere(1,slices,stacks);
glPopMatrix();
// ... Continuar con las estructuras 51 a 100 con coordenadas diferentes ...
}
void graficarEjes(){
glBegin(GL_LINES);
glColor3f(1,0,0);
glVertex3f(-40,0,0);
glVertex3f(40,0,0);
glColor3f(0,1,0);
glVertex3f(0,-40,0);
glVertex3f(0,40,0);
glColor3f(0,0,1);
glVertex3f(0,0,0);
glVertex3f(0,0,30);
glEnd();
}
void inicializar(){
glClearColor(0,0,0,0);
glEnable(GL_DEPTH_TEST);
}
case 's':
case 'S':
dollyCamera( DEF_dollyStepSize, 180.0 );
break;
case 'a':
case 'A':
dollyCamera( DEF_dollyStepSize, 90.0 );
break;
case 'd':
case 'D':
dollyCamera( DEF_dollyStepSize, 270.0 );
break;
case 'i':
case 'I':
mouseIsInverted = !mouseIsInverted;
break;
case 'Q':
case 'q':
exit(0);
break;
case 'R':
case 'r':
slices++;
stacks++;
break;
case 'L':
case 'l':
if (slices>3 && stacks>3){
slices--;
stacks--;
}
break;
case 'E':
case 'e':
const GLfloat light_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
const GLfloat light_diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat light_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat light_position[] = { 2.0f, 5.0f, 5.0f, 0.0f };
}
}
void specialFunc( int key, int x, int y ){
switch( key )
{
//giro a la izquierda
case GLUT_KEY_LEFT:
camYaw += 1.0;
clampCamera();
break;
// giro a la derecha.
case GLUT_KEY_RIGHT:
camYaw -= 1.0;
clampCamera();
break;
// mirar hacia arriba.
case GLUT_KEY_UP:
camPitch += 1.0;
clampCamera();
break;
if( !isInMouseDrag )
return;
deltaX = x - viewPortCenterX;
deltaY = y - viewPortCenterY;
if( deltaX == 0 && deltaY == 0 )
return;
glutWarpPointer( viewPortCenterX, viewPortCenterY );
camYaw -= DEF_angleSensitivity * deltaX;
camPitch -= DEF_angleSensitivity * deltaY * ( mouseIsInverted ? -1.0 : 1.0 );
clampCamera();
glutPostRedisplay();
}
void myReshape(int w, int h){
if (!h)
return;
glViewport(0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, (GLfloat) w/(GLfloat) h, 1.0, 1000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
viewPortCenterX = w / 2;
viewPortCenterY = h / 2;
}
void redimensionar(int w, int h){
glViewport(0,0, w,h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90, (float)w/(float)h,2,500);
}
void idle(void){
glutPostRedisplay();
}
static void key(unsigned char key, int x, int y){
switch (key)
{
case '0':
exit(0);
break;
case 'r':
slices++;
stacks++;
break;
case 'l':
if (slices>3 && stacks>3)
{
slices--;
stacks--;
}
break;
case 'f':
const GLfloat light_ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
const GLfloat light_diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat light_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
const GLfloat light_position[] = { 2.0f, 5.0f, 5.0f, 0.0f };
glutPostRedisplay();
}
void graficar(void){
glMatrixMode(GL_PROJECTION);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glutDisplayFunc(graficar);
glutReshapeFunc(myReshape);
glutKeyboardFunc(keyboard);
glutSpecialFunc( specialFunc );
glutMouseFunc( mouseFunc );
glutMotionFunc( allMotionFunc );
glutPassiveMotionFunc( allMotionFunc );
glutIdleFunc(idle);
glClearColor(0,0,0,0);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glEnable(GL_LIGHT0);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
glutMainLoop();
return 0;
}