Manual

388 views

Published on

una manual de open gl creado por eduardo valdivia solis y marcos daniel tampa hernandez

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
388
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Manual

  1. 1. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMAC glClearColor(1.0,0.0,0.0,0.0);TABLERO //color de fondo void dibuja(void) glMatrixMode(GL_PROJECTI //funcion dibuja ON); //Modo de proyeccion { glLoadIdentity(); glClear(GL_COLOR_BUFFER //Establece los parametros de _BIT); //borra pantalla proyeccion glColor3f(0.0 , 0.0 , 0.0); gluOrtho2D(0.0, 1000.0, 0.0, 1000.0); //vista ortogonal glPointSize(30);void inicializa(void) } glBegin(GL_POINTS);{ glVertex2i(100,100);glVertex2i(220,100); glVertex2i(460,160); glColor3f(1.0 , 1.0 , 1.0);glVertex2i(340,100); glEnd (); glPointSize(30);glVertex2i(460,100); glColor3f(0.0 , 0.0 , 0.0); glBegin(GL_POINTS);glEnd (); glPointSize(30); glVertex2i(160,220);glColor3f(1.0 , 1.0 , 1.0); glBegin(GL_POINTS); glVertex2i(280,220);glPointSize(30); glVertex2i(160,160); glVertex2i(400,220);glBegin(GL_POINTS); glVertex2i(280,160); glVertex2i(520,220);glVertex2i(160,100); glVertex2i(400,160); glEnd();glVertex2i(280,100); glVertex2i(520,160); glColor3f(1.0 , 1.0 , 1.0);glVertex2i(400,100); glEnd(); glPointSize(30);glVertex2i(520,100); glColor3f(0.0 , 0.0 , 0.0); glBegin(GL_POINTS);glEnd (); glPointSize(30); glVertex2i(100,280);glColor3f(1.0 , 1.0 , 1.0); glBegin(GL_POINTS); glVertex2i(220,280);glPointSize(30); glVertex2i(100,220); glVertex2i(340,280);glBegin(GL_POINTS); glVertex2i(220,220); glVertex2i(460,280);glVertex2i(100,160); glVertex2i(340,220); glEnd ();glVertex2i(220,160); glVertex2i(460,220); glColor3f(0.0 , 0.0 , 0.0);glVertex2i(340,160); glEnd (); glPointSize(30);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  2. 2. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACglBegin(GL_POINTS); glEnd (); glVertex2i(220,520);glVertex2i(160,280); glColor3f(0.0 , 0.0 , 0.0); glVertex2i(340,520);glVertex2i(280,280); glPointSize(30); glVertex2i(460,520);glVertex2i(400,280); glBegin(GL_POINTS); glEnd ();glVertex2i(520,280); glVertex2i(160,400); glColor3f(0.0 , 0.0 , 0.0);glEnd(); glVertex2i(280,400); glPointSize(30);glColor3f(0.0 , 0.0 , 0.0); glVertex2i(400,400); glBegin(GL_POINTS);glPointSize(30); glVertex2i(520,400); glVertex2i(160,520);glBegin(GL_POINTS); glEnd(); glVertex2i(280,520);glVertex2i(100,340); glColor3f(0.0 , 0.0 , 0.0); glVertex2i(400,520);glVertex2i(220,340); glPointSize(30); glVertex2i(520,520);glVertex2i(340,340); glBegin(GL_POINTS); glEnd();glVertex2i(460,340); glVertex2i(100,460);glEnd (); glVertex2i(220,460); glFlush(); //forza dibujoglColor3f(1.0 , 1.0 , 1.0); glVertex2i(340,460); }glPointSize(30); glVertex2i(460,460);glBegin(GL_POINTS); glEnd ();glVertex2i(160,340); glColor3f(1.0 , 1.0 , 1.0);glVertex2i(280,340); glPointSize(30);glVertex2i(400,340); glBegin(GL_POINTS);glVertex2i(520,340); glVertex2i(160,460);glEnd(); glVertex2i(280,460);glColor3f(1.0 , 1.0 , 1.0); glVertex2i(400,460);glPointSize(30); glVertex2i(520,460);glBegin(GL_POINTS); glEnd();glVertex2i(100,400); glColor3f(1.0 , 1.0 , 1.0);glVertex2i(220,400); glPointSize(30);glVertex2i(340,400); glBegin(GL_POINTS);glVertex2i(460,400); glVertex2i(100,520);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  3. 3. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMAC glVertex2i(1000,289); CASITA glVertex2i(1000,280); glVertex2i(0,280); // Casa glColor3f (0.0, 5.0, 1.0); //pasto glVertex2i(210,450); glColor3f (0.4, 0.8, 0.2); glVertex2i(540,450); glVertex2i(0,240); glVertex2i(540,195); glVertex2i(1000,240); glVertex2i(210,195);void dibuja(void) glVertex2i(1000,120); // Techo casa{ glVertex2i(0,120); glColor3f (0.0, 0.0, 1.0); int i,j=0; //banqueta glVertex2i(210,495); glColor3f (0.6, 0.6, 0.6); glVertex2i(540,495);/* borra la pantalla */ glVertex2i(0,120); glVertex2i(585,450);glClear(GL_COLOR_BUFFER_BIT); glVertex2i(1000,120); glVertex2i(165,450); glVertex2i(1000,90); // Techo cochera// Cerca glVertex2i(0,90); glColor3f (5.0, 0.0, 1.5);for(i=0;i<50;i++){ glVertex2i(75,345);glBegin(GL_POLYGON); glColor3f (1.0, 1.0, 0.0); glVertex2i(210,345);glColor3f (0.5, 0.4, 0.3); glVertex2i(0,90); glVertex2i(210,315);glVertex2f(0+20*i,292); glVertex2i(1000,90); glVertex2i(60,315);glVertex2f(5+20*i,300); glVertex2i(1000,82); //CortinaglVertex2f(10+20*i,292); glVertex2i(0,82); glColor3f (0.0, 0.0, 0.9);glVertex2f(10+20*i,240); //calle glVertex2i(90,315);glVertex2f(0+20*i,240); glColor3f (0.3, 0.3, 0.3); glVertex2i(210,315);glEnd(); glVertex2i(0,82); glVertex2i(210,195);} glVertex2i(1000,82); glVertex2i(90,195);glBegin(GL_QUADS); glVertex2i(1000,0); glVertex2i(0,0); //PuertaglVertex2i(0,289); glColor3f (0.0, 1.0, 1.0);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  4. 4. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACglVertex2i(345,300); //Ventanas i glVertex2i(360,285);glVertex2i(405,300); glColor3f (6.0, 0.5, 0.0); glVertex2i(390,285);glVertex2i(405,195); glVertex2i(240,435); glVertex2i(390,210);glVertex2i(345,195); glVertex2i(300,435); glVertex2i(360,210); glVertex2i(300,375); glVertex2i(240,375); //Tallos//Columnas glColor3f (0.5, 0.3, 0.2);glColor3f (0.9, 0.0, 0.3); glVertex2i(240,300); glVertex2i(670,225);glVertex2i(75,315); glVertex2i(300,300); glVertex2i(700,225);glVertex2i(90,315); glVertex2i(300,240); glVertex2i(700,150);glVertex2i(90,195); glVertex2i(240,240); glVertex2i(670,150);glVertex2i(75,195); //Ventanas dglVertex2i(210,330); glVertex2i(450,435); glEnd();glVertex2i(540,330); glVertex2i(510,435);glVertex2i(540,315); glVertex2i(510,375); glBegin(GL_TRIANGLES);glVertex2i(210,315); glVertex2i(450,375); // Techo balcon glColor3f (0.5, 0.3, 0.2); glVertex2i(450,300); glVertex2i(375,480);glVertex2i(330,435); glVertex2i(510,300); glVertex2i(435,435);glVertex2i(345,435); glVertex2i(510,240); glVertex2i(315,435);glVertex2i(345,195); glVertex2i(450,240); glEnd();glVertex2i(330,195); //Ventanas balcon //arboles glVertex2i(345,435); glLineWidth (3);glVertex2i(405,435); glVertex2i(405,435); glBegin(GL_LINES);glVertex2i(420,435); glVertex2i(405,330); glColor3f (0.0, 0.7, 0.8);glVertex2i(420,195); glVertex2i(345,330); for(i=0;i<32;i++){glVertex2i(405,195); glVertex2i(680-3*i,540-10*j); //Ventanas puerta glVertex2i(690+3*i,540-10*j);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  5. 5. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACglVertex2i(685-3*i,535-10*j); glVertex2i(240,397); glEnd();glVertex2i(695+3*i,535-10*j); glVertex2i(300,397); glBegin(GL_LINE_LOOP); glVertex2i(450,397); glVertex2i(240,300); glVertex2i(510,397); glVertex2i(300,300);j=j+1; glVertex2i(450,262); glVertex2i(300,240);} glVertex2i(510,262); glVertex2i(240,240);glEnd(); glVertex2i(375,434); glEnd(); glVertex2i(375,375); glBegin(GL_LINE_LOOP);//Linea Calle glVertex2i(270,397); glVertex2i(450,435);glLineWidth (4); glVertex2i(270,375); glVertex2i(510,435);glColor3f (1.0, 0.0, 1.0); glVertex2i(270,262); glVertex2i(510,375);glBegin(GL_LINES); glVertex2i(270,240); glVertex2i(450,375); glEnd();for(i=0;i<50;i++){ glVertex2i(480,397); glBegin(GL_LINE_LOOP);glVertex2i(0+120*i,41); glVertex2i(480,375); glVertex2i(450,300);glVertex2i(90+120*i,41); glVertex2i(480,262); glVertex2i(510,300);} glVertex2i(480,240); glVertex2i(510,240); glVertex2i(450,240);//Barandal glEnd();glColor3f (1.0, 0.4, 1.0); glEnd();glVertex2i(344,375); //ChapaglVertex2i(406,375); //Contorno ventanas glPointSize(4);for(i=0;i<7;i++){ glBegin(GL_LINE_LOOP); glColor3f (0.0, 0.0, 0.0);glVertex2i(345+10*i,375); glColor3f (1.0, 0.0, 1.0); glBegin(GL_POINTS);glVertex2i(345+10*i,330); glVertex2i(240,435); glVertex2i(352,247);} glVertex2i(300,435); glVertex2i(352,245);//Divicion Ventana glColor3f (1.0, 0.0, 9.0); glEnd();glVertex2i(240,262); glVertex2i(300,375);glVertex2i(300,262); glVertex2i(240,375);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  6. 6. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMAC glLineWidth(8); //cuadro CUBO CON CUBITOS glBegin(GL_QUADS); //izquierda //cuadro glVertex2i(600,600+a*i); //izquierda glVertex2i(600,700+a*i); glVertex2i(600,600+a*i); //arriva glVertex2i(600,700+a*i); glVertex2i(600,700+a*i); //arriva glVertex2i(700,700+a*i); glVertex2i(700,700+a*i); //derechavoid dibuja(void)//funcion dibuja //derecha glVertex2i(700,700+a*i);{ glVertex2i(700,600+a*i); glVertex2i(700,600+a*i);int i,a=100; //abajo //abajoglClear(GL_COLOR_BUFFER glEnd(); glVertex2i(700,600+a*i);_BIT); glColor3f(0.0 ,1.0 ,0.5 ); glVertex2i(600,600+a*i);///////////////////////////////////////////////// glLineWidth(8); //diagonal derecha esquina/////////////////////////// arriva glBegin(GL_QUADS);///////////////////////////////////////////////// glVertex2i(650,750+a*i);////////////////////////// //cuadro glVertex2i(600,700+a*i);for(i=0;i<=10;i++){ //izquierda //linea cuadro atrasglColor3f(0.0,0.0,0.6 ); glVertex2i(600,700+a*i); //linea cuadro atrasglLineWidth(8); glVertex2i(650,750+a*i); glVertex2i(650,750+a*i);glBegin(GL_QUADS); //arriva glVertex2i(750,750+a*i);//izquierda glVertex2i(750,750+a*i); //linea derecha atrasglVertex2i(700,600+a*i); //derecha glVertex2i(750,750+a*i);glVertex2i(700,700+a*i); glVertex2i(700,700+a*i); glVertex2i(750,650+a*i);//arriva //abajoglVertex2i(750,750+a*i); glEnd(); //linea abajo derecha diagonal//derecha //cuadro glVertex2i(700,600+a*i);glVertex2i(750,650+a*i); glColor3f(1.0 ,1.0 ,0.0 ); glVertex2i(750,650+a*i); glLineWidth(4); //linea arriva derecha diagonalglEnd(); glBegin(GL_LINES); glVertex2i(700,700+a*i);glColor3f(1.0,0.0,0.1 );Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  7. 7. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACglVertex2i(750,750+a*i); glVertex2d(200,300); glVertex2d(200,300); glVertex2d(100,350); glVertex2d(200,100);CUBODELINEADO //derecho glVertex2d(400,300); glColor3f(0.0 , 0.0 , 0.9); glVertex2d(400,100); glVertex2d(300,150); //atras glVertex2d(400,100); glColor3f(0.0 , 0.0 , 1.0); glVertex2d(400,300); glVertex2d(300,350); glVertex2d(300,350); glVertex2d(100,350);void dibuja(void) //arriba glVertex2d(100,150);//funcion dibuja glColor3f(6.0 , 0.5 , 1.8); glVertex2d(100,350);{ glVertex2d(200,300); //abajoglClear(GL_COLOR_BUFFER_BIT); //borra pantalla glVertex2d(400,300); glColor3f(0.0, 0.0, 1.0);glBegin(GL_QUADS); glVertex2d(300,350); glVertex2d(200,100);//atras glVertex2d(100,350); glVertex2d(400,100);glColor3f(0.0 , 0.0 , 0.0); //frente //izquierdaglVertex2d(100,150); glColor3f(0.5 , 0.5 , 1.0); glColor3f(0.0, 0.0, 1.0);glVertex2d(300,150); glVertex2d(200,100); glVertex2d(100,150);glVertex2d(300,350); glVertex2d(400,100); glVertex2d(200,100);glVertex2d(100,350); glVertex2d(400,300); glVertex2d(200,300);//abajo glVertex2d(200,300); glVertex2d(100,350);glColor3f(0.0 , 0.4 , 0.7); glEnd(); //derechoglVertex2d(200,100); glLineWidth(3); glColor3f(0.0 , 0.0 , 1.0);glVertex2d(400,100); glBegin(GL_LINES); glVertex2d(400,300);glVertex2d(300,150); glColor3f(1.0,0.0,0.5); glVertex2d(300,350);glVertex2d(100,150); glColor3f(0.0 , 0.0 , 0.0); //arriba//izquierda glVertex2d(200,100); glColor3f(0.0 , 0.0 , 1.0);glColor3f(0.0 , 0.6 , 2.0); glVertex2d(400,100); glVertex2d(200,300);glVertex2d(100,150); glVertex2d(400,300); glVertex2d(400,300);glVertex2d(200,100); glVertex2d(200,300); glVertex2d(300,350);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  8. 8. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACglVertex2d(100,350); glVertex2i(200,100); glVertex2i(200,100); glVertex2i(400,700);ESTRELLAvoid inicializa(void){glClearColor(0.0,0.0,0.0,0.0);//color de fondoglMatrixMode(GL_PROJECTION); //Modo deproyeccionglLoadIdentity();//Establece los parametros deproyecciongluOrtho2D(0.0, 1000.0, 0.0,1000.0); //vista ortogonal}void dibuja(void)//funcion dibuja{glClear(GL_COLOR_BUFFER_BIT); //borra pantallaglColor3f(1.0 , 2.0 , 3.0);glBegin(GL_LINES);glVertex2i(400,700);glVertex2i(700,100);glVertex2i(700,100);glVertex2i(100,500);glVertex2i(100,500);glVertex2i(800,500);glVertex2i(800,500);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  9. 9. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMAC glClear(GL_COLOR_BUFFERMOVIMIENTO _BIT | GL_DEPTH_BUFFER_BIT); //abajo if(x>=1 && x<500){circulo(100+1*x,100,40 );x++;} if(w==500){ x=1;y=1; z=1; w=1;}int x=1, y=1,z=1,w=1; glFlush();void inicializa(void){ glutSwapBuffers();glClearColor(0.0,5.0,1.0,1.0); }glMatrixMode(GL_PROJECTION); int main (int argc, char** argv)glLoadIdentity();gluOrtho2D(0.0, 700.0, 0.0,700.0);// el ancho y largo denuestra pantalla}void circulo(int x, int y, intradio){ int angulo=0; glBegin(GL_TRIANGLE_FAN); glColor3f (0.1, 0.0,1.0); glVertex2f(x,y); glColor3f(0,2.0,0.0); for(angulo=0;angulo<=360;angulo+=6){ glVertex2f(x +sin(angulo) * radio, y +cos(angulo) * radio);} glEnd();}void dibuja(void){Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  10. 10. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMAC }MOVIMIENTOCIRCULAR void dibuja(void) { glClear(GL_COLOR_BUFFER _BIT | GL_DEPTH_BUFFER_BIT);//e sto glColor3f(1.0,0.0,0.0); circulo( 600+ sin(ang) *void inicializa(void) rad,700 + cos(ang) * rad,50); //funcion circulo{ glColor3f(1.0,0.0,0.0);glClearColor(0.0,0.0,1.0,0.0);glMatrixMode(GL_PROJECTION); a+=0.5;glLoadIdentity(); ang=ang+0.3; //velocidad entre mas grande mas rapidogluOrtho2D(0.0, 1000.0, 0.0, y entre menos mas lento1000.0);// el ancho y largo denuestra pantalla} for(int j=1;j<=10000000;j++){}//pausa if(ang==360){ang=0;}// sevoid circulo(int x, int y, int repite idefinidamenteradio) glFlush(); //forzar dibujado{ glutSwapBuffers(); //y esto int angulo=0; } glBegin(GL_TRIANGLE_FAN); glColor3f (1.0, 0.9,0.0); int main (int argc, char** argv) glVertex2f(x,y); glColor3f(1.0,0.1,0.0); for(angulo=0;angulo<=360;angulo++){ glVertex2f(x +sin(angulo) * radio, y +cos(angulo) * radio);} glEnd();Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  11. 11. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMAC circulo(300,180,50);MOVIMIENTO EN8 glColor3f(1.0,0.9,0.0); if(a>=6.15 && a<=12.41){ circulo(300+ sin (a)*60,300- cos(a)*60,10); a=a+0.06;void circulo(int x, int y, int }radio){ else{ int angulo=0; circulo(300 + sin (b) *60,180- cos(b)*-60,10); glBegin(GL_TRIANG b=b + 0.6;LE_FAN); if(b>12.4){a=6.15;b=6.15;} glVertex2f(x,y); for(int j=0; j<=10000000; j++) for {}(angulo=0;angulo<=360;angulo+=6){ glVertex2f(x + }sin(angulo) * radio, y +cos(angulo) * radio);} glEnd();} void dibuja(void){glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT);glColor3f(0.5, 0.8, 0.9);circulo(300, 300, 70);circulo(300,180,70);glColor3f(5.0,0.9,0.0);circulo(300,300,50);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  12. 12. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMAC for circulo(195,400,20);MUÑECO BONITO (angulo=0;angulo<=360; angulo+=1){ glVertex2f(x + circulo(305,400,20); sin(angulo) * radio, y + cos(angulo) * radio);} //cabeza glEnd(); circulo(250,400,60); } glColor3f(0.0 , 0.0 , 0.0); circulo(230,400,20); void circulo(int x, int y, int circulo(270,400,20); radio) glColor3f(0.8,0.6,0.0); { circulo(100,170,15); int angulo=0; glColor3f(0.8,0.6,0.0);void inicializa(void) circulo(400,180,15); glBegin(GL_TRIANG{ LE_FAN); glEnd();glClearColor(1.0,1.0,1.0,0.0); // glColor3f (1.0, 0.0, 1.0);//color de fondo glVertex2f(x,y);glMatrixMode(GL_PROJECTION); //Modo de glBegin(GL_TRIANGLES);proyeccion for glColor3f(0.0 ,0.0 , 0.0);glLoadIdentity(); (angulo=0;angulo<=360;//Establece los parametros de angulo+=1){ glVertex2f(x + glVertex2i(250,460);proyeccion sin(angulo) * radio, y + cos(angulo) * radio);} glVertex2i(234,480);gluOrtho2D(0.0, 800.0, 0.0,700.0); //vista ortogonal glEnd(); glVertex2i(225,453);} } glColor3f(0.0 ,0.0 , 0.0);void circuloc(int x, int y, int t, glVertex2i(225,453);int radio) void dibuja(void) glVertex2i(212,474);{ //funcion dibuja glVertex2i(205,440); int angulo=0; { glColor3f(0.0 ,0.0 , 0.0); glPointSize(t); glClear(GL_COLOR_BUFFER _BIT); glVertex2i(250,460); glVertex2i(264,480); glBegin(GL_POINTS); glVertex2i(275,453); //glColor3f (1.0, 0.0, 1.0); glColor3f(0.0 ,0.0 , 0.0); //orejas glVertex2f(x,y); glVertex2i(275,453); glColor3f(0.8,0.6,0.0); //glColor3f(0,0.0,0.0);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  13. 13. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACglVertex2i(295,470); glEnd(); glVertex2i(120,230);glVertex2i(298,438); //mano izquierdaglColor3f(0.0 ,0.0 , 0.0); glColor3f(0.8 , 0.6 , 0.0);glVertex2i(250,460); glVertex2i(400,190);glVertex2i(234,480); glBegin(GL_QUADS); glVertex2i(390,170);glVertex2i(225,453); //cuello glVertex2i(320,300);glEnd(); glColor3f(0.8 , 0.6 , 0.0); glVertex2i(330,320); glVertex2i(265,345); //brazo izquierdo//gafas glVertex2i(240,345); glColor3f(1.0 , 0.0 , 0.0);glLineWidth(5); glVertex2i(240,315); glVertex2i(340,325);glBegin(GL_LINES); glVertex2i(265,315); glVertex2i(315,305);glColor3f(0.0 , 0.0 , 0.0); //cuerpo glVertex2i(360,200);glVertex2d(220,390); glColor3f(1.0 , 0.0 , 0.0); glVertex2i(380,230);glVertex2d(190,420); glVertex2i(170,325);glVertex2d(270,390); glVertex2i(340,325); //botonesglVertex2d(310,420); glVertex2i(340,150); glColor3f(.0 , 0.0 , 0.0); glVertex2i(170,150); glVertex2i(270,300);glVertex2d(240,355); //mano derecha glVertex2i(240,300);glVertex2d(265,360); glColor3f(0.8 , 0.6 , 0.0); glVertex2i(240,280);glEnd(); glVertex2i(140,220); glVertex2i(270,280); glVertex2i(130,240);//nariz glVertex2i(100,170); glColor3f(0.0 , 0.0 , 0.0);glLineWidth(5); glVertex2i(110,170); glVertex2i(270,270);glBegin(GL_LINES); glVertex2i(240,270);glColor3f(0.0 , 0.0 , 0.0); //brazo derecho glVertex2i(240,255);glVertex2d(250,390); glColor3f(1.0 , 0.0 , 0.0); glVertex2i(270,255);glVertex2d(245,370); glVertex2i(170,325);glVertex2d(245,370); glVertex2i(200,305); glColor3f(0.0 , 0.0 , 0.0);glVertex2d(255,370); glVertex2i(140,200); glVertex2i(270,240);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  14. 14. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACglVertex2i(240,240); //ebillaglVertex2i(240,225); glColor3f(0.8,0.6,0.9);glVertex2i(270,225); circulo(255,160,10); glEnd(); //zapatosglColor3f(0.0 , 0.0 , 0.0); glBegin(GL_TRIANGLES);glVertex2i(270,210); glColor3f(1.0 ,0.0 , 1.0);glVertex2i(240,210); glVertex2i(155,20);glVertex2i(240,200); glVertex2i(170,35);glVertex2i(270,200); glVertex2i(220,20);//pantalonglColor3f(0.0 , 0.0 , 0.0);glVertex2i(170,150); //zapatosglVertex2i(260,150); glBegin(GL_TRIANGLES);glVertex2i(220,20); glColor3f(1.0 ,0.0 , 1.0);glVertex2i(170,35); glVertex2i(355,20);//pantalon glVertex2i(340,35);glColor3f(0.0 , 0.0 , 0.0); glVertex2i(290,20);glVertex2i(250,150);glVertex2i(340,150);glVertex2i(340,35); //cuello2glVertex2i(290,20); glBegin(GL_TRIANGLES);//cinturon glColor3f(0.8 ,0.6 , 0.0);glColor3f(0.0 , 0.0 , 1.0); glVertex2i(235,325);glVertex2i(170,150); glVertex2i(270,325);glVertex2i(340,150); glVertex2i(255,305);glVertex2i(340,170);glVertex2i(170,170);glEnd();Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  15. 15. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMAC glVertex2i(0,115); glVertex2i(239,335);MUÑECOTRIANGULOS glVertex2i(0,0); glVertex2i(261,335); glVertex2i(500,0); glVertex2i(250,314); glVertex2i(500,115); glColor3f(0.0 , 0.2 , 0.0); glEnd(); glVertex2i(208,335); glColor3f(4.0 , 0.0 , 0.0); glColor3f(1.0 , 1.0 , 3.0); glLineWidth(4); glVertex2i(170,241); glBegin(GL_TRIANGLES); glColor3f(5.0 , 1.0 , 5.0);void inicializa(void) glVertex2i(184,405); glVertex2i(160,279);{ glVertex2i(314,405); glColor3f(1.0 , 0.7 , 1.0);glClearColor(1.0,1.0,1.0,1.0);//color de fondo glVertex2i(250,468); glVertex2i(160,279);glMatrixMode(GL_PROJECTI glColor3f(0.9 , 0.0 , 1.0); glColor3f(0.0 , 1.0 , 0.9);ON); //Modo deproyeccion glVertex2i(215,405); glVertex2i(151,298);glLoadIdentity(); glVertex2i(287,405); glColor3f(0.0 , 0.3 , 1.0);//Establece los parametros deproyeccion glVertex2i(250,335); glVertex2i(142,260);gluOrtho2D(0.0, 500.0, glColor3f(0.9 , 0.7 , 3.0); glColor3f(0.9 , 0.2 , 0.4);0.0,500.0); //vista ortogonal glVertex2i(239,335); glVertex2i(329,240);} glVertex2i(261,335); glColor3f(1.0 , 1.0 , 1.0);void dibuja(void) glVertex2i(250,314); glVertex2i(339,279);//funcion dibuja glEnd(); glColor3f(1.0 , 1.0 , 1.0);{ glBegin(GL_QUADS); glVertex2i(293,335);glClear(GL_COLOR_BUFFER_BIT); //borra pantalla glColor3f(5.0 , 1.0 , 0.0); glColor3f(0.1 , 0.8 , 0.4);glBegin(GL_QUADS); glVertex2i(208,335); glVertex2i(348,297);glColor3f(0.0 , 0.0 , 1 .0); glVertex2i(292,335); glColor3f(1.0 , 1.0 , 1.0);glVertex2i(0,500); glVertex2i(293,241); glVertex2i(357,259);glVertex2i(500,500); glVertex2i(208,241); glVertex2i(339,279);glVertex2i(500,114); glEnd(); glColor3f(1.0 , 0.9 , 0.6);glVertex2i(0,114); glBegin(GL_TRIANGLES); glVertex2i(333,326); glColor3f(0.0 , 0.7 , 0.5); glVertex2i(391,326);glColor3f(0.0 , 1.0 , 0.1);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  16. 16. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACglVertex2i(362,247); glColor3f(1.0 , 0.0 , 0.0); glColor3f(0.0 , 0.0 , 0.0);glColor3f(0.7 , 0.7 , 0.9); glVertex2i(292,158); glVertex2i(308,143);glVertex2i(362,250); glVertex2i(316,178); glVertex2i(322,143);glVertex2i(348,326); glVertex2i(333,158); glVertex2i(322,128);glVertex2i(341,322); glColor3f(0.0 , 0.0 , 0.0); glVertex2i(322,143);glColor3f(0.4 , 0.6 , 0.8); glVertex2i(308,158); glVertex2i(322,128);glVertex2i(377,326); glVertex2i(308,143); glVertex2i(337,128);glVertex2i(384,322); glVertex2i(293,143); glVertex2i(337,143);glVertex2i(364,250); glVertex2i(322,158); glVertex2i(322,143);glColor3f(0.4 , 0.6 , 0.4); glVertex2i(322,143); glVertex2i(322,157);glVertex2i(239,241); glVertex2i(337,143); glVertex2i(308,157);glColor3f(1.0 , 0.0 , 1.0); glVertex2i(337,128); glVertex2i(308,143);glVertex2i(239,96); glVertex2i(322,128); glVertex2i(308,143);glColor3f(1.0 , 1.0 , 1.0); glVertex2i(322,113); glVertex2i(308,128);glVertex2i(214,210); glVertex2i(308,128); glVertex2i(293,128);glColor3f(1.0 , 0.0 , 0.0); glVertex2i(308,113); glVertex2i(293,143);glVertex2i(238,95); glVertex2i(293,128);glVertex2i(195,96); glColor3f(1.0 , 0.9 , 0.0);glVertex2i(213,117); glVertex2i(362,246);glColor3f(0.9 , 0.7 , 0.5); glVertex2i(383,239);glVertex2i(256,241); glVertex2i(341,239);glColor3f(1.0 , 1.0 , 1.0); glEnd();glVertex2i(256,210); glBegin(GL_QUADS);glColor3f(1.0 , 1.0 , 1.0); glColor3f(0.0 , 0.0 , 0.0);glVertex2i(299,210); glVertex2i(308,128);glColor3f(0.9 , 0.7 , 0.5); glVertex2i(322,128);glVertex2i(299,210); glVertex2i(322,113);glVertex2i(282,189); glVertex2i(308,113);glVertex2i(290,158); glVertex2i(308,128);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  17. 17. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMAC circulo(250,250,100); glColor3f(0.0,0.0,0.0);OSO //pie izquierdo circulo(275,425,10); glColor3f(0.6,0.4,0.2); circulo(150,150,50); glColor3f(0.0,0.0,0.0); //mano dercha circuloc(275,425,10); glColor3f(0.6,0.4,0.2); circulo(350,325,50); //mano izquierdavoid inicializa(void) glColor3f(0.6,0.4,0.2);{ circulo(150,325,50);glClearColor(1.0,1.0,1.0,0.0);//color de fondo //pie derechoglMatrixMode(GL_PROJECTI glColor3f(0.6,0.4,0.2);ON); //Modo deproyeccion circulo(350,150,50);glLoadIdentity(); //cabeza//Establece los parametros de glColor3f(0.6,0.4,0.2);proyeccion circulo(250,400,65);gluOrtho2D(0.0, 500.0, 0.0,500.0); //vista ortogonal //oreja derecha} glColor3f(0.6,0.4,0.2);void circulo(int x, int y, int t, int circulo(320,450,25);radio); //oreja izquierda glColor3f(0.6,0.4,0.2); circulo(180,450,25);void dibuja(void)//funcion dibuja //nariz{ glColor3f(1.0,0.0,0.0);glClear(GL_COLOR_BUFFER circulo(250,380,10);_BIT); //borra pantalla //ojo izquierdoglColor3f(1.0 , 2.0 , 3.0); glColor3f(0.0,0.0,0.0); circulo(225,425,10);glBegin(GL_CIRCLES);//borra pantalla //ojo derechoEduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  18. 18. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMAC //izquierdaPIRÁMIDE glVertex2i (240-20*i,240-20*i); glVertex2i (240-20*i,260+20*i);void inicializa(void) //arriba{ glVertex2i (240-20*i,260+20*i);glClearColor(1.0,1.0,1.0,1.0);//color de fondo glVertex2i (260+20*i,260+20*i);glMatrixMode(GL_PROJECTION); //Modo deproyeccionglLoadIdentity();//Establece los parametros deproyecciongluOrtho2D(0.0, 1000.0, 0.0,1000.0); //vista ortogonal}void dibuja(void)//funcion dibuja{ int i=100;glClear(GL_COLOR_BUFFER_BIT); //borra pantallaglLineWidth(5);glColor3f(1.0,0.0,0.0);glBegin(GL_LINES);for (i=0;i<=10;i++){ //abajoglVertex2i (240-20*i,240-20*i);glVertex2i (260+20*i,240-20*i); //derechaglVertex2i (260+20*i,240-20*i);glVertex2i(260+20*i,260+20*i);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  19. 19. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMAC angulo+=1){ glVertex2f(x + glColor3f(1.4 ,0.7 ,0.4 );SEMAFORO sin(angulo) * radio, y + cos(angulo) * radio);} glLineWidth(8); glEnd(); glBegin(GL_QUADS); } glColor3f(1.4 ,0.9 ,0.0 ); void circulo(int x, int y, int glVertex2i(350,750); radio) glVertex2i(650,750); { glColor3f(0.0 ,0.9 ,0.0 ); int angulo=0; glVertex2i(650,450);int glVertex2i(350,450); glBegin(GL_TRIANGx=1,z=1,c=1,d=1,e=1,b=1,w=1 LE_FAN);,a=1, y=1; glEnd();void inicializa(void) glColor3f(0.5 ,0.7 ,0.4 ); //glColor3f(0,0.0,0.0);{ glLineWidth(10); forglClearColor(1.5,0.0,5.0,0.0); glBegin(GL_QUADS); (angulo=0;angulo<=360;glMatrixMode(GL_PROJECTI angulo+=6){ glVertex2f(x + glColor3f(1.4 ,0.9 ,6.0 );ON); sin(angulo) * radio, y + cos(angulo) * radio);} glVertex2i(475,100);glLoadIdentity(); glVertex2i(525,100);gluOrtho2D(0.0, 800.0, 0.0,800.0);// el ancho y largo de glColor3f (0.0, 0.0, 0.0); glColor3f(1.4 ,0.9 ,0.4 );nuestra pantalla glVertex2f(x,y); glVertex2i(525,450);} glVertex2i(475,450);void circuloc(int x, int y, int t, //glColor3f(0,0.0,0.0);int radio) glEnd(); for{ (angulo=0;angulo<=360; circuloc(500,700,4,40); angulo+=6){ glVertex2f(x + int angulo=0; sin(angulo) * radio, y + circuloc(500,600,4,40); cos(angulo) * radio);} glPointSize(t); circuloc(500,500,4,40); glEnd(); glColor3f(0.0,0.0,0.0); glBegin(GL_POINTS) } circulo(500,700,40);; void dibuja(void) circulo(500,600,40); glColor3f (0.0, 0.0, 0.0); { circulo(500,500,40); glVertex2f(x,y); glClear(GL_COLOR_BUFFER _BIT | glColor3f(1.0,0.0,0.0); glColor3f(0,0.0,0.0); GL_DEPTH_BUFFER_BIT); for(angulo=0;angulo<=360;Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  20. 20. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACif(x>=1 && x<600){ a++; e++;circulo(500,700,50); } if(e==300) {a=1 ;c=1;b=1; e=1; d=1;z=1;x=1;y=1;w=1;}glFlush(); glColor3f(1,1.0,0.0); }x++; if(b>=1 && b<300 && y==800 && x==600 && w==600 &&} a==300){ glutSwapBuffers();glColor3f(1.0,1.0,0.0); circulo(500,600,50); }if(y>=1 && y<800 && x==600){ glFlush();circulo(500,600,50); b++;glFlush(); }y++; glColor3f(0,0.0,0.0);} if(c>=1 && c<300 && y==800 && x==600 && w==600 &&glColor3f(0.0,1.0,0.0); a==300 && b==300){if(w>=1 && w<600 && y==800 circulo(500,600,50);&& x==600){ glFlush();circulo(500,500,50); c++;glFlush(); }w++; glColor3f(1,1.0,0.0);} if(d>=1 && d<300 && y==800glColor3f(1,1.0,0.0); && x==600 && w==600 && a==300 && b==300 &&if(z>=1 && z<800 && y==800 c==300 ){&& x==600 && w==600){ circulo(500,600,50);circulo(500,600,50); glFlush();glFlush(); d++;z++; }} glColor3f(0,0.0,0.0);glColor3f(0,0.0,0.0); if(e>=1 && e<300 && y==800if(a>=1 && a<300 && y==800 && x==600 && w==600 &&&& x==600 && w==600 && a==300 && b==300 &&z==800){ c==300 && d==300){circulo(500,600,50); circulo(500,600,50);glFlush(); glFlush();Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  21. 21. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACSISTEMA SOLAR glColor3f (0.9,0.8, 0.0); for circulo(500,500,50); (angulo=0;angulo<=360; angulo++){ glVertex2f(x + circulo( 500+ sin(ang) * sin(angulo) * radio, y + 70,500 + cos(ang) * 70,10); cos(angulo) * radio);} glColor3f (1.0,1.0, 1.0); glEnd(); circuloc(500,500,1,70); } //funcion circulo glColor3f (0.5, 0.5, 0.0); void circuloc(int x, int y, int circulo( 500- sin(a) *int rad=100; 150,500 + cos(a) * 150,10); t, int radio)double glColor3f (1.0,1.0, 1.0); {ang=0,a=0,b=0,c=0,d=0,f=0,g=0,h=0; int angulo=0; circuloc(500,500,1,150);void inicializa(void) glPointSize(t); glColor3f (0.6, 0.5, 0.7);{ circulo( 500+ sin(b) * glBegin(GL_POINT 200,500 + cos(b) * 200,10);glClearColor(0.0,0.0,0.0,1.0 S);); glColor3f (1.0,1.0, 1.0); //glColor3f (1.0, 0.0,glMatrixMode(GL_PROJEC circuloc(500,500,1,200); 1.0);TION); glVertex2f(x,y);glLoadIdentity(); glColor3f (0.0,0.4, 0.0); //glColor3f(0,0.0,0.0gluOrtho2D(0.0, 1000.0, );0.0, 1000.0);// el ancho ylargo de nuestra pantalla for circulo( 500- sin(c) * (angulo=0;angulo<=360; 250,500 + cos(c) * 250,10);} angulo+=1){ glVertex2f(x + sin(angulo) * radio, y + circuloc(500,500,1,250); cos(angulo) * radio);}void circulo(int x, int y, intradio) glEnd(); glColor3f (0.2,0.0, 0.0);{ } int angulo=0; void dibuja(void) circulo( 500+ sin(d) * { 300,500 + cos(d) * 300,10); glBegin(GL_TRIAN glClear(GL_COLOR_BUFF circuloc(500,500,1,300);GLE_FAN); ER_BIT | GL_DEPTH_BUFFER_BIT) glColor3f (1.0,1.0, 1.0); glVertex2f(x,y); ;//estoEduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  22. 22. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACglColor3f (1.0,0.1, 0.4);circulo( 500- sin(f) *350,500 + cos(f) * 350,10);circuloc(500,500,1,350);glColor3f (1.0,1.0, 1.0);glColor3f (0.1,0.5, 1.6);circulo( 500+ sin(g) *400,500 + cos(g) * 400,10);circuloc(500,500,1,400);glColor3f (1.0,1.0, 1.0);glColor3f (1.0,1.0, 1.0);circulo( 500- sin(h) *450,500 + cos(h) * 450,10);circuloc(500,500,1,450);glColor3f (1.0,0.6, 0.0);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  23. 23. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACCUBO glVertex2i(20,300); glVertex2i(175,100); glVertex2i(20,100); glVertex2i(175,300); glVertex2i(175,100); glVertex2i(175,300); glVertex2i(20,300);void inicializa(void) glVertex2i(100,200);{ glVertex2i(100,400);glClearColor(1.0,1.0,1.0,1.0 glVertex2i(250,200);); //color de fondo glVertex2i(250,400);glMatrixMode(GL_PROJECTION); //Modo de glVertex2i(100,200);proyeccion glVertex2i(250,200);glLoadIdentity();//Establece los parametros glVertex2i(100,400);de proyeccion glVertex2i(250,400);gluOrtho2D(0.0, 1000.0, glVertex2i(100,400);0.0, 1000.0); //vistaortogonal glVertex2i(20,300);} glVertex2i(100,200); glVertex2i(20,100);void dibuja(void) glVertex2i(250,200);//funcion dibuja glVertex2i(175,100);{ glVertex2i(250,400);glClear(GL_COLOR_BUFFER_BIT); //borra glVertex2i(175,300);pantallaglLineWidth(5);glColor3f(1.0,0.0,0.0);glBegin(GL_LINES); glVertex2i(20,100);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  24. 24. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACANIMACION for //izquierda (angulo=0;angulo<=360; angulo+=6){ glVertex2f(x + if(x==500 && y==500 && sin(angulo) * radio, y + z==500 && k>=1 && cos(angulo) * radio);} k<500){circulo(100,100- 1*k,40);k++; //rinicio glEnd();} if(k==500){x=1; y=1; z=1; } k=1;} void dibuja(void) {int x=1, y=1; glClear(GL_COLOR_BUFF //if(x>300 && y>300 &&void inicializa(void) ER_BIT | z>300 && GL_DEPTH_BUFFER_BIT) k>300){circulo(200,500-{ ; 1*k,40);k++; //rinicioglClearColor(0.0,1.0,0.0,0.0 if(x>=1 && x<800){ //if(k==500){x=1; y=1; z=1;); k=1;} }glMatrixMode(GL_PROJECTION); //abajo glFlush();glLoadIdentity(); if(x>=1 && x<500){circulo(100+1*x,100 x++;gluOrtho2D(0.0, 1200.0, ,40);x++;};0.0, 300.0);// el ancho y }largo de nuestra pantalla //if(x>=1 && <<300){circulo(200+1*x,20 glutSwapBuffers();} 0,40);x++;}; } //derechavoid circulo(int x, int y, int if(x==500 && y>=1 &&radio){ y<500){circulo(600,100+1*y ,40);y++;} int main (int argc, char**{ argv) //if(x>300 & y>=1 && int angulo=0; y<300){circulo(500,200+1*y ,40);y++;} glBegin(GL_TRIAN //arribaGLE_FAN); glColor3f (0.5,0.5, 0.5); if(x==500 && y==500 && z<=1 && z>500){ glVertex2f(x,y); circulo(600- 1*z,600,40);z++; } glColor3f(0,0.0,0.0);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  25. 25. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACNOMBRE glVertex3f(i,-long_eje,0); glBegin(GL_TRIANGLES); glVertex3f(i,long_eje,0); glVertex3f(-long_eje,i,0); glColor3f(0.0,0.0,1.0); glVertex3f(long_eje,i,0); glVertex3f(11.0,0.0,0.0); glVertex3f(i,0,- glVertex3f(10.5,0.0,- long_eje); .50); glVertex3f(i,0,long_eje); glVertex3f(10.5,0.0,.50); glVertex3f(-long_eje,0,i); glColor3f(1.0,0.0,0.0); glVertex3f(long_eje,0,i); glVertex3f(0.0,11.0,0.0);GLfloat anguloEsfera =0.0f; } glVertex3f(-GLfloat .50,10.5,0.0); glEnd();girax=0,giray=0,zoom=0,e,f glVertex3f(.50,10.5,0.0);; }GLboolean glColor3f(0.0,1.0,0.0);malla=GL_FALSE,ejes=GL_TRUE; void creaEjes(void){ glVertex3f(0.0,0.0,11.0); glColor3f(0.0,0.0,0.0); glVertex3f(- glBegin(GL_LINES); .50,0.0,10.5);void mover(void){ glColor3f(0.0,0.0,1.0); glVertex3f(.50,0.0,10.5); glTranslated(0,0,zoom); glVertex3f(- //puntas otrasglRotated(girax,1.0,0.0,0.0) 11.0,0.0,0.0); glColor3f(0.0,0.0,1.0);; glVertex3f(11.0,0.0,0.0); glVertex3f(- glColor3f(1.0,0.0,0.0); 11.0,0.0,0.0);glRotated(giray,0.0,1.0,0.0); glVertex3f(- glVertex3f(0.0,- 11.0,0.0); 10.5,0.0,.50); } glVertex3f(0.0,11.0,0.0); glVertex3f(-10.5,0.0,-void creaMalla(void){ .50); glColor3f(0.0,1.0,0.0); int i, long_eje=10; glColor3f(1.0,0.0,0.0); glColor3f(1.0,1.0,0.0); glVertex3f(0.0,0.0,- 11.0); glVertex3f(0.0,- 11.0,0.0); glBegin(GL_LINES); glVertex3f(0.0,0.0,11.0); glVertex3f(.50,- for(i=- glEnd(); 10.5,0.0);long_eje;i<=long_eje;i++){Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  26. 26. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMAC glVertex3f(-.50,- glMatrixMode(GL_ glColor3d(1,1,1);10.5,0.0); MODELVIEW); // position and aim the camera for (i=0; i<360; i+=10) {glColor3f(0.0,1.0,0.0); glLoadIdentity(); angulo = glVertex3f(0.0,0.0,- gluLookAt(5.0, 5.0, (GLfloat)i*3.14159f/180.0f;11.0); 5.0, 0.0, 0.0, 0.0, 0.0, 2.0, // grados a radianes 0.0); glVertex3f(.50,0.0,- glColor3d(1,1,1);10.5); } glVertex3i(0,0,-3); glVertex3f(-.50,0.0,- void dibuja( void )10.5); { glVertex3f(0+cos(angulo)*4 glEnd(); 5, 0+sin(angulo)*45,0); glClear ( GL_COLOR_BUFFER_BIT } | } GL_DEPTH_BUFFER_BIT glEnd();*/ );void init ( void ) // Colocamos una luz glEnable(GL_DEPT{ glLightfv(GL_LIGHT0,GL_D H_TEST); // Activamos el IFFUSE,(GLfloat z-Buffer []){0.0f,1.0f,5.0f,0.0f}); //glClearColor(1.0,1.0,1.0,0.0 Color de la luz) ;// Definimos el glEnable(GL_LIGHTING);negro como color de fondo glLightfv(GL_LIGHT0,GL_A // Activamos la iluminación MBIENT,(GLfloat []){9.0, glEnable(GL_LIGH 1.0, 1.0, 4.0}); // Luz T0); // Activamos la luz 0 ambiente glEnable(GL_DEPTH_TEST); // Activamos el glLightfv(GL_LIGHT0,GL_Pz-Buffer OSITION,(GLfloat //glShadeModel(GL []){0.0f,9.0f,5.0f,5.0f}); // _FLAT); Posición de la luzglEnable(GL_LIGHTING);// Activamos la iluminación glShadeModel glLightfv(GL_LIGHT0,GL_E (GL_SMOOTH); MISSION,(GLfloat glEnable(GL_LIGH []){5.5,0.5,0.5,6.0});T0); // Activamos la luz 0 // Cargamos la matriz identidad para reiniciar las //glShadeModel transformaciones (GL_SMOOTH); glMatrixMode(GL_ /* float angulo; // esferaPROJECTION); // set theview volume shape int i; glPushMatrix(); glLoadIdentity(); glLineWidth(20); mover();glOrtho(-15,15,-15,15,-30,30); glBegin(GL_LINES); if(malla) creaMalla();Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  27. 27. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACif(ejes) creaEjes(); glutSolidCube(1); glutSolidCube(1);//glRotatef(anguloEsfera, glTranslatef(0.0,1.0,0.0); glTranslatef(-2.0,-2.0,0.0);1.0f, 1.0f,0.0f); glutSolidCube(1); glutSolidCube(1);glColor3f(1.0,1.0,0.0); glTranslatef(0.0,1.0,0.0); glTranslatef(-1.0,0.0,0.0);//R glutSolidCube(1); glutSolidCube(1);glTranslatef(-8.0,0.0, 0.0); glTranslatef(0.0,1.0,0.0); glTranslatef(2.0,0.0,0.0);glutSolidCube(1); glutSolidCube(1); glutSolidCube(1);glTranslatef(0.0,1.0, 0.0); glTranslatef(0.0,1.0,0.0);glutSolidCube(1); glutSolidCube(1);glTranslatef(0.0,1.0, 0.0); glTranslatef(3.0,-2.0,0.0);glutSolidCube(1); glTranslatef(1.0,0.0,0.0); glutSolidCube(1);glTranslatef(0.0,1.0, 0.0); glutSolidCube(1); glTranslatef(0.0,1.0,0.0);glutSolidCube(1); glTranslatef(1.0,0.0,0.0); glutSolidCube(1);glTranslatef(0.0,1.0, 0.0); glutSolidCube(1); glTranslatef(0.0,1.0,0.0);glutSolidCube(1); glTranslatef(1.0,0.0,0.0); glutSolidCube(1);glTranslatef(0.0,1.0, 0.0); glutSolidCube(1); glTranslatef(0.0,1.0,0.0);glutSolidCube(1); glTranslatef(1.0,0.0,0.0); glutSolidCube(1);glTranslatef(-1.0,0.0,0.0); glutSolidCube(1); glTranslatef(0.0,1.0,0.0);glutSolidCube(1); glutSolidCube(1);glTranslatef(-1.0,0.0,0.0); glTranslatef(0.0,-5.0,0.0); glTranslatef(0.0,1.0,0.0);glutSolidCube(1); glutSolidCube(1); glutSolidCube(1);glTranslatef(3.0,0.0,0.0); glTranslatef(0.0,1.0,0.0);glutSolidCube(1); glutSolidCube(1); glTranslatef(1.0,0.0,0.0);glTranslatef(1.0,0.0,0.0); glTranslatef(0.0,1.0,0.0); glutSolidCube(1);glutSolidCube(1); glutSolidCube(1); glTranslatef(1.0,0.0,0.0);glTranslatef(2.0,-5.0,0.0); glTranslatef(0.0,1.0,0.0); glutSolidCube(1);glutSolidCube(1); glutSolidCube(1); glTranslatef(0.0,-1.0,0.0);glTranslatef(0.0,1.0,0.0); glTranslatef(0.0,1.0,0.0); glutSolidCube(1);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  28. 28. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACglTranslatef(0.0,-1.0,0.0);glutSolidCube(1); glTranslatef(2.0,0.0,0.0); glTranslatef(4.0,-3.0,0.0); glutSolidCube(1); glutSolidCube(1);glTranslatef(1.0,0.0,0.0); glTranslatef(0.0,1.0,0.0); glTranslatef(0.0,1.0,0.0);glutSolidCube(1); glutSolidCube(1); glutSolidCube(1);glTranslatef(1.0,0.0,0.0); glTranslatef(0.0,1.0,0.0); glTranslatef(0.0,1.0,0.0);glutSolidCube(1); glutSolidCube(1); glutSolidCube(1);glTranslatef(0.0,1.0,0.0); glTranslatef(0.0,1.0,0.0); glTranslatef(0.0,1.0,0.0);glutSolidCube(1); glutSolidCube(1); glutSolidCube(1);glTranslatef(0.0,1.0,0.0); glTranslatef(0.0,1.0,0.0); glTranslatef(0.0,1.0,0.0);glutSolidCube(1); glutSolidCube(1); glutSolidCube(1);glTranslatef(1.0,0.0,0.0); glTranslatef(0.0,1.0,0.0); glTranslatef(0.0,1.0,0.0);glutSolidCube(1); glutSolidCube(1); glutSolidCube(1);glTranslatef(1.0,0.0,0.0); glTranslatef(1.0,0.0,0.0); glTranslatef(1.0,0.0,0.0);glutSolidCube(1); glutSolidCube(1); glutSolidCube(1);glTranslatef(0.0,-1.0,0.0); glTranslatef(1.0,0.0,0.0); glTranslatef(1.0,0.0,0.0);glutSolidCube(1); glutSolidCube(1); glutSolidCube(1);glTranslatef(0.0,-1.0,0.0); glTranslatef(1.0,0.0,0.0);glutSolidCube(1); glTranslatef(1.0,0.0,0.0); glutSolidCube(1); glutSolidCube(1); glTranslatef(1.0,0.0,0.0);glTranslatef(0.0,-1.0,0.0); glTranslatef(0.0,-1.0,0.0); glutSolidCube(1);glutSolidCube(1); glutSolidCube(1); glTranslatef(0.0,-1.0,0.0); glTranslatef(0.0,-1.0,0.0); glutSolidCube(1);glTranslatef(0.0,-1.0,0.0); glutSolidCube(1); glTranslatef(0.0,-1.0,0.0);glutSolidCube(1); glTranslatef(-1.0,0.0,0.0); glutSolidCube(1); glutSolidCube(1); glTranslatef(0.0,-1.0,0.0);glTranslatef(0.0,-1.0,0.0); glTranslatef(-1.0,0.0,0.0); glutSolidCube(1);glutSolidCube(1); glutSolidCube(1); glTranslatef(0.0,-1.0,0.0);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas
  29. 29. COLEGIO DE ESTUDIOS CIENTÍFICOS Y TECNOLÓGICOS PLANTEL TECAMACglutSolidCube(1);glTranslatef(0.0,-1.0,0.0);glutSolidCube(1);glTranslatef(-1.0,2.0,0.0);glutSolidCube(1);glTranslatef(-1.0,0.0,0.0);glutSolidCube(1);glTranslatef(-1.0,0.0,0.0);glutSolidCube(1);Eduardo Valdivia SolísMarcos Daniel Tampa Hernández Manual de Practicas

×