Professional Documents
Culture Documents
Mariposa Pintada
Mariposa Pintada
#include<windows.h>
#include<math.h>
#include <GL/glut.h>
#define PI 3.1415926535898
//float a,b;
glClearColor(r,g,b,0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D (-8.0,8.0,-8.0,8.0);
}
void Display(void){
glClearColor(1,1,1,0);
glClear(GL_COLOR_BUFFER_BIT);
float x,y,r;
//ALA DERECHA SUPERIOR
//SOMBREADO
glBegin(GL_POLYGON);
glColor3f(0.9,0.2,0.2);
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//BORDE
glBegin(GL_LINE_STRIP);
glColor3f(0,0,0);
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//ALA IZQUIERDA SUPERIOR
//SOMBREADO
glBegin(GL_POLYGON);
glColor3f(0.9,0.2,0.2);
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//BORDE
glBegin(GL_LINE_STRIP);
glColor3f(0,0,0);
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//borde
glBegin(GL_LINE_STRIP);
glColor3f(0,0,0);
glLineWidth(200.5);
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//ALA IZQUIERDA INFERIOR
//SOMBREADO
glBegin(GL_POLYGON);
glColor3f(1,0.8,0.8);
glLineWidth(200.5);
r=2.011*(exp(cos(i))-(2.011*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//BORDE
glBegin(GL_LINE_STRIP);
glColor3f(0,0,0);
glLineWidth(200.5);
r=2.011*(exp(cos(i))-(2.011*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//BRAZITO DERECHO
//SOMBREADO
glBegin(GL_POLYGON);
glColor3f(1,1,0);
glLineWidth(200.5);
r=2.011*(exp(cos(i))-(2.011*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//BORDE
glBegin(GL_LINE_STRIP);
glColor3f(0,0,0);
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//BRAZITO IZQUIERDO
//SOMBREADO
glBegin(GL_POLYGON);
glColor3f(1,1,0);
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//BORDE
glBegin(GL_POINTS);
glColor3f(0,0,0);
glLineWidth(25);
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//CABEZA
//SOMBREADO
glBegin(GL_POLYGON);
glColor3f(0.5,0.5,1);
glLineWidth(200.5);
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//BORDE
glBegin(GL_LINE_STRIP);
glColor3f(0,0,0);
glLineWidth(5);
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//CABECITA
//SOMBREADO
glBegin(GL_POLYGON);
glColor3f(0.7,0.7,0.7);
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
//BORDE
glBegin(GL_LINE_STRIP);
glColor3f(0,0,0);
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
r=2*(exp(cos(i))-(2*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
glBegin(GL_POLYGON);
glColor3f(0.7,0.7,0.7);
glLineWidth(200.5);
r=2.011*(exp(cos(i))-(2.011*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
glBegin(GL_LINE_STRIP);
glColor3f(0,0,0);
glLineWidth(89.5);
r=2.011*(exp(cos(i))-(2.011*cos(4*i)));
x=sin(i)*r;
y=r*cos(i);
glVertex2f(x,y);
}
glEnd();
glFlush();
}
int main (int argc,char** argv)
{
//funcion glut para la inicializacion de la ventana
glutInit(&argc,argv);//inializamos
glutInitDisplayMode(GLUT_SINGLE |GLUT_RGB);
glutInitWindowSize(600,600);// tamanio de la ventana
glutInitWindowPosition(100,100);//posicionde la ventana
glutCreateWindow("Mariposa");// crea la venta con nombre
return EXIT_SUCCESS;
}