Butterfly Lifecycle CG Project With Free Source Code

Code is 100% error free
Still if you have any errors and if you don't know how to run code feel free to WhatsApp us or Comment below, Thank You.
 DOWNLOAD REPORT NOW
DESCRIPTION

         Computer graphics butterfly lifecycle project shows the real lifecycle of the butterfly. Their are totally 4 stages in butterfly lifecycle. The first stage is egg stage and the second stage is caterpillar/larva and the third stage is chrysalis/pupa and the last stage that is fourth stage is adult. In the first stage the egg develops and then converted into a caterpillar as a second stage and then it sits on the tree and starts covering itself and convert into again egg like a structure called pupa as a thirst stage and then at the last stage finally it is going to convert into a butterfly and this is the last stage of the butterfly lifecycle. Understanding natural butterfly lifecycle using computer graphics is going to be very beautiful. Here the exact lifecycle of the butterfly is shown and by hitting the mouse buttons you can see every stage of the butterfly lifecycle. 

BUTTERFLY CODE

void butterfly(float x,float y)
{
float scale=.6;
glPushMatrix();
glTranslatef(0+x,0+y,-80);
glRotatef(90,0,0,1);
if(flap) glRotatef(-40,1,0,0);
glScalef(scale, scale,1);
glBegin(GL_POLYGON);
float cx=0,cy=0,cz=0;
for(int i=0;i<5000;i++)
{
cx+=(1.0/5000);
cy-=(1.0/5000);
cz+=(1.0/5000);
glColor3f(cx,cy,cz);
double t=i*24*3.14159265/5000;
double expr = pow(exp(cos(t))-2*cos(4*t)-sin(t/12),3);
GLfloat X = sin(t)*expr;
GLfloat Y = -cos(t)*expr;
if(Y>=0)
glVertex2f(X,Y);
}
glEnd();
glFlush();
glPopMatrix();
glPushMatrix();
glTranslatef(0+x,0+y,-80);
glRotatef(90,0,0,1);
if(flap) glRotatef(-40,-1,0,0);
glScalef(scale, scale,1);
glScalef(1,-1,1);
cx=0,cy=0,cz=0;
glBegin(GL_POLYGON);
for(int i=0;i<5000;i++)
{
cx+=(1.0/5000);
cy-=(1.0/5000);
cz+=(1.0/5000);
glColor3f(cx,cy,cz);
double t=i*24*3.14159265/5000;
double expr = pow(exp(cos(t))-2*cos(4*t)-sin(t/12),3);
GLfloat X = sin(t)*expr;
GLfloat Y = -cos(t)*expr;
if(Y>=0)
glVertex2f(X,Y);
}
glEnd();
glPopMatrix();
glFlush();
}

KEYBOARD & MOUSE FUNCTIONS

  • Click mouse to begin cycle.
CONCLUSION

    The butterfly begins in the egg and grows into something completely different through a series of four life stages. The four stages of life during this change or metamorphosis are - egg, larva, larva and adult butterfly. In each stage, the butterfly looks different and has a different goal to achieve.

    Although all butterflies have the same life cycle, the time it takes a single butterfly to complete one life cycle can vary from just over 30 days to over 200 days in an emperor!
Please Comment Your Reviews About the Code & Report Below.
Post a Comment (0)
Previous Post Next Post