Professional Documents
Culture Documents
S H I e L D
S H I e L D
D
//CASTILLO CANTERA MARIA
//COMPUTACION GRAFICA 2019-2
#include <windows.h>
#include <GL/glut.h>
#include <stdlib.h>
#include <math.h>
#define M_PI 3.141516
void Circunferencia( float *XY, float R, float *rgb, int M, float T){
glColor3fv(rgb);
switch (M) {
case 2: {
glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
glPointSize(T); break;
}
case 3:{
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glLineWidth(T);
break;
}
default:{glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
}
glColor3f(0.0,0.0,0.0);
glBegin(GL_POLYGON);
for (float i = 0; i <= 2*M_PI ; i = i + 0.05){
glVertex2f(R*cos(i) + XY[0], R*sin(i) + XY[1]);
}
glEnd();
}
void Display(void)
{
glClearColor(1,1,1,0);//color el cual se limpia la ventana
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_POLYGON);
glColor3f(0,0,0);
for (float i=0;i<=2*M_PI;i=i+0.0009){
glVertex2d(0.72*cos(i),0.72*sin(i));
}
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.6,0.6,0.6);
for (float i=0;i<=2*M_PI;i=i+0.0009){
glVertex2d(0.68*cos(i),0.7*sin(i));
}
glEnd();
float black[]={0,0,0};
float C[]={0.0,0.0};
Circunferencia(C,0.65, black, 4, 1);
//CABEZA
glBegin(GL_POLYGON);
glColor3f(0.6,0.6,0.6);
glVertex2d(0.07,0.356);
for (float i=0;i<=2*M_PI;i=i+0.0009){
//glEnd();
//glBegin(GL_POLYGON);
for (float i=0;i<=2*M_PI;i=i+0.0009){
glEnd();
glBegin(GL_POLYGON);
glColor3f(0,0,0);
glEnd();
//CUERPO
glBegin(GL_POLYGON);
glColor3f(0.6,0.6,0.6);
glVertex2d(0.0,-0.22);
glVertex2d(-0.074,0.356);
glVertex2d(-0.15,0.23);
for (float i=0;i<=2*M_PI;i=i+0.0009){
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.6,0.6,0.6);
glVertex2d(0.0,-0.22);
for (float i=0;i<=2*M_PI;i=i+0.0009){
// glVertex2f(0.5*cos(i) , 0.5*sin(i) );
if ( i >= M_PI/6 && i<M_PI/4){
glVertex2f(0.6*cos(i) , 0.6*sin(i) );
}
}
glVertex2d(0.15,0.23);
glVertex2d(0.074,0.356);
glVertex2d(-0.074,0.356);
glEnd();
//ALA1
glBegin(GL_POLYGON);
glColor3f(0.6,0.6,0.6);
for (float i=0;i<=2*M_PI;i=i+0.0009){
if ( i >= 5.1*M_PI/6 && i<M_PI){
glVertex2f(0.6*cos(i) , 0.6*sin(i));
}
}
glVertex2d(-0.43,0.16);
glEnd();
//ALA1 REFLEJO
glBegin(GL_POLYGON);
glColor3f(0.6,0.6,0.6);
for (float i=0;i<=2*M_PI;i=i+0.0009){
if ( i >= 0 && i< 0.9*M_PI/6){
glVertex2f(0.6*cos(i) , 0.6*sin(i));
}
}
glVertex2d(0.43,0.16);
glEnd();
//ALA2
glBegin(GL_POLYGON);
glColor3f(0.6,0.6,0.6);
glVertex2d(-0.42,0.15);
for (float i=0;i<=2*M_PI;i=i+0.0009){
if ( i >= 12.1*M_PI/12&& i<13.2*M_PI/12){
glVertex2f(0.6*cos(i) , 0.6*sin(i));
}
}
glVertex2d(-0.32,0.04);
glEnd();
//ALA2 REFLEJO
glBegin(GL_POLYGON);
glColor3f(0.6,0.6,0.6);
glVertex2d(0.32,0.04);
for (float i=0;i<=2*M_PI;i=i+0.0009){
if ( i >= 22.7*M_PI/12&& i< 23.8*M_PI/12){
glVertex2f(0.6*cos(i) , 0.6*sin(i));
}
glVertex2d(0.42,0.15); }
glEnd();
//ALAS3
glBegin(GL_POLYGON);
glColor3f(0.6,0.6,0.6);
glVertex2d(-0.3,0.025);
for (float i=0;i<=2*M_PI;i=i+0.0009){
if ( i >= 13.4*M_PI/12&& i<4.8*M_PI/4){
glVertex2f(0.6*cos(i) , 0.6*sin(i));
}
}
glVertex2d(-0.2,-0.08);
glEnd();
//ALAS3 REFLEJO
glBegin(GL_POLYGON);
glColor3f(0.6,0.6,0.6);
glVertex2d(0.2,-0.08);
glEnd();
//COLA
glBegin(GL_POLYGON);
glColor3f(0.6,0.6,0.6);
glVertex2d(-0.1,-0.15);
for (float i=0;i<=2*M_PI;i=i+0.0009){
if ( i >= 4.95*M_PI/4&& i<3*M_PI/2){
glVertex2f(0.6*cos(i) , 0.6*sin(i));
}
}
glVertex2d(0.0,-0.25);
glEnd();
//COLA2
glBegin(GL_POLYGON);
glColor3f(0.6,0.6,0.6);
glVertex2d(0.1,-0.15);
glVertex2d(0.0,-0.25);
glEnd();
glFlush();
}
glutDisplayFunc(Display);
glClearColor(1,1,1,1);
//funcion glut para el manejo de eventos
glutMainLoop();
return EXIT_SUCCESS;
}