Documentos de Académico
Documentos de Profesional
Documentos de Cultura
h>
#ifdef __APPLE__
#else
#include <GL/glut.h>
#endif
#include <stdlib.h>
#include<math.h>
#define M_pi 3.141515
//void display(void);
//void keyboard(unsigned char key,int x,int y);
//static void circunferencia(float r,float angi,float angf,float cx,float cy,float
*col);
//static void circunferenciaRelleno(float radio,float angi,float angf,float
centrox,float centroy,float *color);
//static void triangulo(float *p1,float *p2,float *p3,float *color);
//static void cuerpo(float r,float *color);
}
///metodo triangulo
static void triangulo(float *p1,float *p2,float *p3,float *color){
glColor3fv(color);
glBegin(GL_TRIANGLES );
glVertex2fv(p1);
glVertex2fv(p2);
glVertex2fv(p3);
glEnd();
}
/// circunferencia(RADIO,AnguloInicial,AnguloFinal,centrox,centroy,color)
static void circunferencia(float radio,float angi,float angf,float centrox,float
centroy,float *color){
glColor3fv(color);
float x1,y1,x,y;
float angulopaso = 0.01;
glPointSize(1);
glLineWidth(1);
glColor3fv(color);
glBegin(GL_POINTS);
for(float i=0;i<=360*M_PI/180;i=i+0.001){
x = radio*cos(i)+centrox;
y = radio*sin(i)+centroy;
if(i>=angi*M_PI/180 && i<=angf*M_PI/180){
glVertex2f(x, y);
}
}
glEnd();
}
glColor3fv(color);
glBegin(GL_POLYGON);
for(float i=0;i<=360*M_PI/180;i=i+0.009){
if(i>=angi*M_PI/180 && i<=angf*M_PI/180){
glVertex2f(radio*cos(i)+centrox, radio*sin(i)+centroy);
}
}
glVertex2f(centrox,centroy);
glEnd();
}
glClearColor(1,1,1,1);
glClear(GL_COLOR_BUFFER_BIT);
float negro[]={0,0,0},plomo[]={0.3,0.3,0.35};
float blanco[]={1,1,1};
float azul[]={0,0,1,1};
float rojo[]={1,0,0,1};
float ang=0.01;
float f[]={0.285,0.092},e[]={-0.176,-0.242},h[]={-0.067,0.092};
float d[]={-0.285,0.092},j[]={0,-0.114};
float c[]={0,0.3},g[]={0.176,-0.242},k[]={-0.108,-0.035};
circunferenciaRelleno(0.88,0,360,0.0,0.0,negro);
circunferenciaRelleno(0.85,0,360,0.0,0.0,plomo);
circunferenciaRelleno(0.82,0,360,0.0,0.0,negro);
cuerpo(0.71,plomo);
///circunferencia para la cabeza
circunferenciaRelleno(0.546,78.72,94.35,0.034,-0.036,plomo);
///pico superior
circunferenciaRelleno(0.039,0,360,0.136,0.460,plomo);
///pico inferior
circunferenciaRelleno(0.067,62.76,139.46,0.141,0.384,negro);
circunferenciaRelleno(0.015,0,360,0.102,0.417,negro);
///nuca
circunferenciaRelleno(0.0624,0,360,0.006,0.447,plomo);
///corrigiendo cuello
glColor3fv(negro);
glBegin(GL_POLYGON);
glVertex2f(0.166,0.262);
glVertex2f(0.172,0.443);
glVertex2f(0.088,0.411);
glEnd();
//glutSwapBuffers();
glFlush ();
glutDisplayFunc(&display);
//glutKeyboardFunc(&keyboard);
glutMainLoop();
return EXIT_SUCCESS;
}