You are on page 1of 18

#include<GL/glut.

h>
#include<string.h>
#include<stdio.h>
static float axis = 0.0;
void text1(float G,float H,char *B);
void text(float X,float Y,char *A);
int n,b[5];
void stack();
void x();
void stack1();
void queue();
void arrow1();
void arrow2();
void MyPoint();
void point();
void animateletter();
void path();
void light();
void drawchar();
float aa1=310;//,aa2=300;
int flag=0,z=270;
float a11=280,a12=280,a13=280,a14=280,a15=280,a16=280;
float a1=280,a2=-59,a3=-51,a4=-43,a5=-35,a6=-27,a7=-19;
float a21=126,a22=106,a23=280,a24=280,a25=280,a26=280;
float aaa1=280,aa2=102,aa3=102,aa4=102,aa5=102,aa6=102,aa7=102;
float xz=0,yz=130;
float xy=26,xx=24;
int p=0;
int p1=126, p2=126,p3=126,p4=126,p5=126,p6=126;
int vflag=0;
void heading();
void animateletter1();
void displaypoint(void)
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glColor3f(1,1,1);
heading();
queue();
glColor3f(1,1,1);
text(26,162,"rear end");
stack();
glColor4f(.3,.0,.0,1);
text(-59,280,"10");
text(-51,280,"40");
text(-43,280,"20");
text(-35,280,"80");
text(-19,280,"55");
text(-27,280,"60");
arrow1();
//arrow2();
path();
animateletter();
animateletter1();
//text(0,0,"a");
glFlush();
glutSwapBuffers();
}

void heading()
{
if(aa1>=280)
{
glColor4f(1,1,0,1);
text1(60,aa1,"PRIORITY QUEUE");
aa1-=.7;
}
else
glColor4f(1,1,0,1);
text1(60,aa1,"PRIORITY QUEUE");
}
void queue()
{
glEnable(GL_BLEND);
glBegin(GL_QUADS);
//glColor4f(1,.1,.4,.2);
glColor4f(0.0,0.5,0.2,.5);
glVertex3f(30.0,140.0,0);
glVertex3f(30.0,100.0,0);
glVertex3f(50.0,100.0,0);
glVertex3f(50.0,140.0,0);
glEnd();
glBegin(GL_QUADS);
glColor4f(1,0,0,.5);
glVertex3f(70.0,140.0,0);
glVertex3f(70.0,100.0,0);
glVertex3f(90.0,100.0,0);
glVertex3f(90.0,140.0,0);
glEnd();
glBegin(GL_QUADS);
glColor4f(1.0,0.5,1.0,.5);
glVertex3f(110.0,140.0,0);
glVertex3f(110.0,100.0,0);
glVertex3f(130.0,100.0,0);
glVertex3f(130.0,140.0,0);
glEnd();
glBegin(GL_QUADS);
glColor4f(0.0,0.8,0.2,.5);
glVertex3f(70.0,100.0,0);
glVertex3f(70.0,140.0,0);
glVertex3f(50.0,140.0,0);
glVertex3f(50.0,100.0,0);
glEnd();
glBegin(GL_QUADS);
glColor4f(0.3,0.3,0.3,.5);
glVertex3f(110.0,140.0,0);
glVertex3f(110.0,100.0,0);
glVertex3f(90.0,100.0,0);
glVertex3f(90.0,140.0,0);
glEnd();
glBegin(GL_QUADS);
glColor4f(0,0,1,.5);
glVertex3f(150.0,140.0,0);
glVertex3f(150.0,100.0,0);
glVertex3f(130.0,100.0,0);
glVertex3f(130.0,140.0,0);
glEnd();

//
glBegin(GL_POLYGON);
glColor4f(0.0,0.5,0.2,.5);
glVertex3f(20.0,120.0,10);
glVertex3f(30.0,140.0,0);
glVertex3f(50.0,140.0,0);
glVertex3f(40.0,120.0,10);
glEnd();
glBegin(GL_POLYGON);
glColor4f(0.0,0.8,0.2,.5);
glVertex3f(40.0,120.0,10);
glVertex3f(50.0,140.0,0);
glVertex3f(70.0,140.0,0);
glVertex3f(60.0,120.0,10);
glEnd();
glBegin(GL_POLYGON);
glColor4f(1,0,0,.5);
glVertex3f(60.0,120.0,10);
glVertex3f(70.0,140.0,0);
glVertex3f(90.0,140.0,0);
glVertex3f(80.0,120.0,10);
glEnd();
glBegin(GL_POLYGON);
glColor4f(0.3,0.3,0.3,.5);
glVertex3f(80.0,120.0,10);
glVertex3f(90.0,140.0,0);
glVertex3f(110.0,140.0,0);
glVertex3f(100.0,120.0,10);
glEnd();
glBegin(GL_POLYGON);
glColor4f(1.0,0.5,1.0,.5);
glVertex3f(100.0,120.0,10);
glVertex3f(110.0,140.0,0);
glVertex3f(130.0,140.0,0);
glVertex3f(120.0,120.0,10);
glEnd();
glBegin(GL_POLYGON);
glColor4f(0,0,1,.5);
glVertex3f(120.0,120.0,10);
glVertex3f(130.0,140.0,0);
glVertex3f(150.0,140.0,0);
glVertex3f(140.0,120.0,10);
glEnd();
//
glBegin(GL_POLYGON);
glColor4f(0.0,0.5,0.2,.5);
glVertex3f(20.0,80.0,10);
glVertex3f(30.0,100.0,0);
glVertex3f(50.0,100.0,0);
glVertex3f(40.0,80.0,10);
glEnd();
glBegin(GL_POLYGON);
glColor4f(0.0,0.8,0.2,.5);
glVertex3f(40.0,80.0,10);
glVertex3f(50.0,100.0,0);
glVertex3f(70.0,100.0,0);
glVertex3f(60.0,80.0,10);
glEnd();
glBegin(GL_POLYGON);

glColor4f(1,0,0,.5);
glVertex3f(60.0,80.0,10);
glVertex3f(70.0,100.0,0);
glVertex3f(90.0,100.0,0);
glVertex3f(80.0,80.0,10);
glEnd();
glBegin(GL_POLYGON);
glColor4f(0.3,0.3,0.3,.5);
glVertex3f(80.0,80.0,10);
glVertex3f(90.0,100.0,0);
glVertex3f(110.0,100.0,0);
glVertex3f(100.0,80.0,10);
glEnd();
glBegin(GL_POLYGON);
glColor4f(1.0,0.5,1.0,.5);
glVertex3f(100.0,80.0,10);
glVertex3f(110.0,100.0,0);
glVertex3f(130.0,100.0,0);
glVertex3f(120.0,80.0,10);
glEnd();
glBegin(GL_POLYGON);
glColor4f(0,0,1,.5);
glVertex3f(120.0,80.0,10);
glVertex3f(130.0,100.0,0);
glVertex3f(150.0,100.0,0);
glVertex3f(140.0,80.0,10);
glEnd();
glBegin(GL_QUADS);
glColor4f(0.0,0.5,0.2,.5);
glVertex3f(20.0,120.0,10);
glVertex3f(20.0,80.0,10);
glVertex3f(40.0,80.0,10);
glVertex3f(40.0,120.0,10);
glEnd();
glBegin(GL_QUADS);
glColor4f(1,0,0,.5);
glVertex3f(60.0,80.0,10);
glVertex3f(60.0,120.0,10);
glVertex3f(80.0,120.0,10);
glVertex3f(80.0,80.0,10);
glEnd();
glBegin(GL_QUADS);
glColor4f(1.0,0.5,1.0,.5);
glVertex3f(100.0,80.0,10);
glVertex3f(100.0,120.0,10);
glVertex3f(120.0,120.0,10);
glVertex3f(120.0,80.0,10);
glEnd();
glBegin(GL_QUADS);
glColor4f(0.0,0.8,0.2,.5);
glVertex3f(60.0,120.0,10);
glVertex3f(60.0,80.0,10);
glVertex3f(40.0,80.0,10);
glVertex3f(40.0,120.0,10);
glEnd();
glBegin(GL_QUADS);
glColor4f(0.3,0.3,0.3,.5);
glVertex3f(100.0,80.0,10);

glVertex3f(100.0,120.0,10);
glVertex3f(80.0,120.0,10);
glVertex3f(80.0,80.0,10);
glEnd();
glBegin(GL_QUADS);
glColor4f(0,0,1,.5);
glVertex3f(140.0,80.0,10);
glVertex3f(140.0,120.0,10);
glVertex3f(120.0,120.0,10);
glVertex3f(120.0,80.0,10);
glEnd();
//
glBegin(GL_LINES);
glColor3f(1,1,1);
glVertex3f(20.0,120.0,10);
glVertex3f(20.0,80.0,10);
glVertex3f(40.0,120.0,10);
glVertex3f(40.0,80.0,10);
glVertex3f(60.0,80.0,10);
glVertex3f(60.0,120.0,10);
glVertex3f(80.0,120.0,10);
glVertex3f(80.0,80.0,10);
glVertex3f(100.0,80.0,10);
glVertex3f(100.0,120.0,10);
glVertex3f(120.0,120.0,10);
glVertex3f(120.0,80.0,10);
glVertex3f(140.0,80.0,10);
glVertex3f(140.0,120.0,10);
glEnd();
glBegin(GL_LINES);
glColor4f(1,1,1,.3);
glVertex3f(30.0,140.0,0);
glVertex3f(30.0,100.0,0);
glVertex3f(50.0,140.0,0);
glVertex3f(50.0,100.0,0);
glVertex3f(70.0,140.0,0);
glVertex3f(70.0,100.0,0);
glVertex3f(90.0,140.0,0);
glVertex3f(90.0,100.0,0);
glVertex3f(110.0,140.0,0);
glVertex3f(110.0,100.0,0);
glVertex3f(130.0,140.0,0);
glVertex3f(130.0,100.0,0);
glColor3f(1,1,1);
glVertex3f(150.0,140.0,0);
glVertex3f(150.0,100.0,0);
//glColor3f(0,0,0);
glEnd();
glBegin(GL_LINES);
//glLineWidth(250);
//
glColor3f(1,1,1);
glVertex3f(20.0,120.0,10);
glVertex3f(30.0,140.0,0);
glVertex3f(40.0,120.0,10);
glVertex3f(50.0,140.0,0);
glVertex3f(60.0,120.0,10);
glVertex3f(70.0,140.0,0);

glVertex3f(80.0,120.0,10);
glVertex3f(90.0,140.0,0);
glVertex3f(100.0,120.0,10);
glVertex3f(110.0,140.0,0);
glVertex3f(120.0,120.0,10);
glVertex3f(130.0,140.0,0);
glVertex3f(140.0,120.0,10);
glVertex3f(150.0,140.0,0);

//

glEnd();
glBegin(GL_LINES);
glColor3f(0,0,0);
glColor4f(1,1,1,.3);
glVertex3f(20.0,80.0,10);
glVertex3f(30.0,100.0,0);
glVertex3f(40.0,80.0,10);
glVertex3f(50.0,100.0,0);
glVertex3f(60.0,80.0,10);
glVertex3f(70.0,100.0,0);
glVertex3f(80.0,80.0,10);
glVertex3f(90.0,100.0,0);
glVertex3f(100.0,80.0,10);
glVertex3f(110.0,100.0,0);
glVertex3f(120.0,80.0,10);
glVertex3f(130.0,100.0,0);

//
glColor3f(1,1,1);
glVertex3f(140.0,80.0,10);
glVertex3f(150.0,100.0,0);
//

glColor3f(1,1,1);

//

glColor3f(0,0,0);
glEnd();
glBegin(GL_LINES);
glColor3f(1,1,1);
glVertex3f(20.0,120.0,10);
glVertex3f(140.0,120.0,10);
glVertex3f(30.0,140.0,0);
glVertex3f(150.0,140.0,0);
glVertex3f(20.0,80.0,10);
glVertex3f(140.0,80.0,10);
glColor4f(1,1,1,.3);
glVertex3f(30.0,100.0,0);
glVertex3f(150.0,100.0,0);
glEnd();

//

//
glFlush();
}
void light()
{
GLfloat mat_ambient[]={1.0f,.0f,.0f,.0f};
GLfloat mat_diffuse[]={1.0f,1.0f,.0f,.0f};
GLfloat mat_specular[]={1.0f,1.0f,1.0f,.0f};
GLfloat mat_shininess[]={100.0f};
glMaterialfv(GL_FRONT,GL_AMBIENT,mat_ambient);
glMaterialfv(GL_FRONT,GL_DIFFUSE,mat_diffuse);

glMaterialfv(GL_FRONT,GL_SPECULAR,mat_specular);
glMaterialfv(GL_FRONT,GL_SHININESS,mat_shininess);
GLfloat lightIntensity[]={1.0f,1.0f,1.0f,1.0f};
GLfloat light_position[]={-4.0f,8.0f,-3.0f,1.0f};
glLightfv(GL_LIGHT0,GL_POSITION,light_position);
glLightfv(GL_LIGHT0,GL_AMBIENT_AND_DIFFUSE,lightIntensity);
}
void stack()
{
glBegin(GL_POLYGON);
glColor3f(0.65,0.65,.8);
glVertex3f(-60,270,0);
glVertex3f(-60,290,0);
glVertex3f(-12,290,0);
glVertex3f(-12,270,0);
glEnd();
//
glBegin(GL_LINES);
//
glColor3f(0,0,0);
glVertex3f(-12,270,0);
glVertex3f(-60,270,0);
glVertex3f(-12,290,0);
glVertex3f(-60,290,0);
glVertex3f(-12,270,0);
glVertex3f(-12,290,0);
glVertex3f(-12-8,270,0);
glVertex3f(-12-8,290,0);
glVertex3f(-12-16,270,0);
glVertex3f(-12-16,290,0);
glVertex3f(-12-24,270,0);
glVertex3f(-12-24,290,0);
glVertex3f(-12-32,270,0);
glVertex3f(-12-32,290,0);
glVertex3f(-12-40,270,0);
glVertex3f(-12-40,290,0);
glVertex3f(-12-48,270,0);
glVertex3f(-12-48,290,0);
glEnd();
//
}
void stack1()
{
glBegin(GL_POLYGON);
glColor3f(0.65,0.65,.8);
glVertex3f(-60,270-50,0);
glVertex3f(-60,290-50,0);
glVertex3f(-12,290-50,0);
glVertex3f(-12,270-50,0);
glEnd();
glBegin(GL_LINES);
glColor3f(1,1,1);
glVertex3f(-12,270-50,0);
glVertex3f(-60,270-50,0);
glVertex3f(-12,290-50,0);
glVertex3f(-60,290-50,0);
glVertex3f(-12,270-50,0);
glVertex3f(-12,290-50,0);

glVertex3f(-12-8,270-50,0);
glVertex3f(-12-8,290-50,0);
glVertex3f(-12-16,270-50,0);
glVertex3f(-12-16,290-50,0);
glVertex3f(-12-24,270-50,0);
glVertex3f(-12-24,290-50,0);
glVertex3f(-12-32,270-50,0);
glVertex3f(-12-32,290-50,0);
glVertex3f(-12-40,270-50,0);
glVertex3f(-12-40,290-50,0);
glVertex3f(-12-48,270-50,0);
glVertex3f(-12-48,290-50,0);
glEnd();
}
//
//
//
void x()
{
glPushMatrix();
glColor3f(1,1,1);
glTranslatef(0,170,0);
stack();
glPushMatrix();
}
void path()
{
glEnable(GL_BLEND);
glColor4f(0.4,.2,.9,1);
glBegin(GL_QUADS);
glColor3f(1,1,0);
glVertex3f(-59,270,0); glColor4f(.2,.2,.2,.4);
glVertex3f(-53,270,0); glColor4f(.1,.1,.1,.4);
glVertex3f(-53,120,0); glColor4f(.4,.4,.4,.4);
glVertex3f(-59,120,0);
glEnd();

//

glBegin(GL_QUADS);
//glColor3f(1,0,0);
glColor3f(0,1,0);
glVertex3f(-51,270,0); glColor4f(.2,.2,.2,.4);
glVertex3f(-45,270,0); glColor4f(.1,.1,.1,.4);
glVertex3f(-45,120,0); glColor4f(.4,.4,.4,.4);
glVertex3f(-51,120,0);
glEnd();
glBegin(GL_QUADS);
glColor3f(0,0,1);
glColor3f(1,0,0);
glVertex3f(-43,270,0);
glColor4f(.2,.2,.2,.4);
glVertex3f(-37,270,0);
glColor4f(.1,.1,.1,.4);
glVertex3f(-37,120,0);
glColor4f(.4,.4,.4,.4);
glVertex3f(-43,120,0);
glEnd();
glBegin(GL_QUADS);
//glColor3f(.3,.3,.3);

glColor3f(1,0,0);
glVertex3f(-35,270,0);
glColor4f(.2,.2,.2,.4);
glVertex3f(-29,270,0);
glColor4f(.1,.1,.1,.4);
glVertex3f(-29,120,0);
glColor4f(.4,.4,.4,.4);
glVertex3f(-35,120,0);
glEnd();
glBegin(GL_QUADS);
glColor3f(0,1,1);
//glColor3f(1,0,0);
glVertex3f(-27,270,0);
glVertex3f(-21,270,0);
glVertex3f(-21,120,0);
glVertex3f(-27,120,0);
glEnd();
glBegin(GL_QUADS);
glColor3f(1,0,1);
//glColor3f(1,0,0);
glVertex3f(-19,270,0);
glVertex3f(-13,270,0);
glVertex3f(-13,120,0);
glVertex3f(-19,120,0);
glEnd();

glColor4f(.2,.2,.2,.4);
glColor4f(.1,.1,.1,.4);
glColor4f(.4,.4,.4,.4);

glColor4f(.2,.2,.2,.4);
glColor4f(.1,.1,.1,.4);
glColor4f(.4,.4,.4,.4);

}
void arrow1()
{
glBegin(GL_POLYGON);
glColor3f(1,1,1);
glVertex3f(32,160,5);glColor3f(.2,.2,0);
glVertex3f(34,160,5);glColor3f(.3,.1,0.3);
glVertex3f(34,136,5);glColor3f(.4,.2,5);
glVertex3f(32,136,5);glColor3f(.6,0,.6);
glEnd();
glBegin(GL_POLYGON);
glVertex3f(36,136,5);glColor3f(0,.0,.2);
glVertex3f(33,130,5);glColor3f(0,.1,.6);
glVertex3f(30,136,5);glColor3f(.1,0.5,.7);
glVertex3f(36,136,5);glColor3f(.6,0,.6);
glEnd();
// // // // // //
}
void arrow2()
{//
//
//
glEnable(GL_BLEND);
//glColor4f(.3,.6,.9,.5);
glBegin(GL_POLYGON);

//glColor3f(1,1,1);
glVertex3f(32+103,170,5);//glColor3f(.2,.2,0);
glVertex3f(34+103,170,5);//glColor3f(.3,.1,0.3);
glVertex3f(34+103,136,5);//glColor3f(.4,.2,5);
glVertex3f(32+103,136,5);//glColor3f(.6,0,.6);
glEnd();
glBegin(GL_POLYGON);

//
///
//
//

glVertex3f(36+103,136,5);//glColor3f(0,.0,.2);
glVertex3f(33+103,130,5);//glColor3f(0,.1,.6);
glVertex3f(30+103,136,5);//glColor3f(.1,0.5,.7);
glVertex3f(36+103,136,5);//glColor3f(.6,0,.6);
glEnd();//glColor3f(1,1,1);
text(120,173,"front end");
//glPushMatrix();
glTranslatef(xz-110,0,5);
//int p=.2;
arrow2();
glPopMatrix();

}
void animatearrow()
{
glPushMatrix();
glTranslatef(-102+p,0,0);
arrow2();
p=0;
glPopMatrix();
}
void spinCube()
{
axis=axis+0.006;
glutPostRedisplay();
}
void MyPoint()
{
glClearColor(.25,.5,.5,1.0);
glColor3f(1.0,0.0,0.0);
glPointSize(10.0);
glOrtho(-100.0,250.0,-100.0,300.0,-10,10);
}
void text(float X,float Y,char *A)
{
glEnable(GL_BLEND);
//
glColor4f(.1,.5,.1,1);
//glColor4f(1,1,1,.8);
int len=strlen(A);
glRasterPos2i(X,Y);
for(int i=0;i<len;i++)
{
glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,A[i]);
}

glFlush();
}
void text1(float G,float H,char *B)
{
glColor3f(1,1,0);
glEnable(GL_BLEND);
//glColor4f(1,1,0,.7);
int len=strlen(B);
glRasterPos2i(G,H);
for(int i=0;i<len;i++)
{
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24,B[i]);
}
glFlush();
}
void animateletter()
{
glColor3f(0.9,.0,.9);
if(flag==1)
{
if(a1>=110)
{
text(-59,a1,"10");
a1=a1-.05;
}
else
{
if(a2<=26)
{
text(a2,102,"10");
a2=a2+.5;
}
else
{
text(a2,102,"10");
}
}
//flag++;
//}
//if(flag==2)
//{
if(a1>=110)
{
text(-51,a1,"40");
a1=a1-.05;
}
else
{
if(a3<=66)
{
text(a3,102,"40");
a3=a3+.4;
}
else
text(a3,102,"40");
}
//

//
//
if(a1>=110)
{
text(-43,a1,"20");
a1=a1-.05;
}
else
{
if(a4<=46)
{
text(a4,102,"20");
a4=a4+.5;
}
else
text(a4,102,"20");
}

if(a1>=110)
{
text(-35,a1,"80");
a1=a1-.05;
}
else
{
if(a5<=126)
{
text(a5,102,"80");
a5=a5+.2;
}
else
text(a5,102,"80");
}
if(a1>=110)
{
text(-19,a1,"55");
a1=a1-.05;
}
else
{
if(a6<=86)
{
text(a6,102,"55");
a6=a6+.3;
}
else
text(a6,102,"55");
}
if(a1>=110)
{
text(-27,a1,"60");
a1=a1-.05;
}
else
{
if(a7<=106)
{
text(a7,102,"60");

a7=a7+.2;
}
else
text(a7,102,"60");
}
}
}
//
//
void animateletter1()
{
if(vflag==1)
{
if(a5<=250)
{
glColor4f(1,1,1,.0);
text(a5,102,"80");
a5=a5+1;
}
/*}
else
{*/
//animatearrow();
glPushMatrix();
glTranslatef(106-p1,0,0);
glColor4f(0,0,1,.8);
arrow2();
p1=126;
glPopMatrix();
/*if(aa2>=50)
{
glColor4f(1,1,1,.0);
text(200,aa2,"80");
aa2=aa2-1;
}*/
}
if(vflag==2)
{
if(a7<=250)
{
glColor4f(1,1,1,.1);
text(a7,102,"60");
a7=a7+1;
}
/*else
{
*/
glPushMatrix();
glTranslatef(86-p2,0,0);
glColor4f(0,0,1,.8);
arrow2();
p2=126;
glPopMatrix();
/*if(aa3>=50)
{
glColor4f(1,1,1,.1);
text(200,aa3,"60");
aa2=aa2-1;
}*/

//}
}

if(vflag==3)
{
if(a6<=250)
{
glColor4f(1,1,1,.1);
text(a6,102,"55");
a6=a6+1;
}

/*

//animatearrow();
glPushMatrix();
glTranslatef(66-p3,0,0);
glColor4f(0,0,1,.8);
arrow2();
p3=126;
glPopMatrix();
if(aa4>=50)
{
glColor4f(1,1,1,.1);
text(200,aa4,"55");
aa4=aa4-1;
}*/

}
if(vflag==4)
{
if(a3<=250)
{
glColor4f(1,1,1,.1);
text(a3,102,"40");
a3=a3+1;
}
//animatearrow();
glPushMatrix();
glTranslatef(46-p4,0,0);
glColor4f(0,0,1,.8);
arrow2();
p4=126;
glPopMatrix();
/*if(aa5>=50)
{
glColor4f(1,1,1,.1);
text(200,aa5,"40");
aa5=aa5-1;
}*/
//animatearrow();
}
if(vflag==5)
{

if(a4<=250)
{
glColor4f(1,1,1,.1);
text(a4,102,"20");
a4=a4+1;
}
//animatearrow();
glPushMatrix();
glTranslatef(26-p5,0,0);
glColor4f(0,0,1,.8);
arrow2();
p5=126;
glPopMatrix();
/*if(aa6>=50)
{
glColor4f(1,1,1,.1);
text(200,aa6,"20");
aa6=aa6-1;
}
*/
//animatearrow();
}
if(vflag==6)
{
if(a2<=250)
{
glColor4f(1,1,1,.1);
text(a2,102,"10");
a2=a2+1;
}
//animatearrow();
glPushMatrix();
glTranslatef(6-p6,0,0);
glColor4f(0,0,1,.2);
arrow2();
p6=126;
glPopMatrix();
/*if(aa7>=50)
{
glColor4f(1,1,1,.1);
text(200,aa7,"10");
aa7=aa7-1;
}*/
glColor3f(1,0,0);
text1(25,60,"empty queue,cannot delete anymore");

}
if(flag==1)
{
if(a2>=20 && a2<=25)
{
glPushMatrix();
glEnable(GL_LIGHTING);

glEnable(GL_LIGHT0);
glShadeModel(GL_SMOOTH);
light();
glPopMatrix();
}
else
{
glDisable(GL_LIGHTING);
glDisable(GL_LIGHT0);
}
}
if(flag==2)
{
if(a3>=40 && a3<=45)
{
glPushMatrix();
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glShadeModel(GL_SMOOTH);
light();
glPopMatrix();
}
else
{
glDisable(GL_LIGHTING);
glDisable(GL_LIGHT0);
}
}
if(flag==3)
{
if(a4>=40 && a4<=45)
{
glPushMatrix();
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glShadeModel(GL_SMOOTH);
light();
glPopMatrix();
}
else
{
glDisable(GL_LIGHTING);
glDisable(GL_LIGHT0);
}
}
if(flag==4)
{
if(a5>=80 && a5<=85)
{
glPushMatrix();
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glShadeModel(GL_SMOOTH);
light();
glPopMatrix();
}
else
{
glDisable(GL_LIGHTING);
glDisable(GL_LIGHT0);

}
}
if(flag==5)
{
if(a6>=80 && a6<=85)
{
glPushMatrix();
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glShadeModel(GL_SMOOTH);
light();
glPopMatrix();
}
else
{
glDisable(GL_LIGHTING);
glDisable(GL_LIGHT0);
}
}
if(flag==6)
{
if(a7>=80 && a7<=85)
{
glPushMatrix();
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glShadeModel(GL_SMOOTH);
light();
glPopMatrix();
}
else
{
glDisable(GL_LIGHTING);
glDisable(GL_LIGHT0);
}
}
}
void menu_l(int id)
{
switch(id)
{
case 1:flag=flag+1;
//animateletter();
break;//insertion operations
case 2: vflag=vflag+1;
break;//deletion operations
case 3: exit(0);
}
}
/*void menus_l(int id)
{
switch(id)
{
case 1:exit(0);//for exiting
}
}*/

//void menu_l(int id)


//{//
//
switch(id)
//{
//case 1:flag=1;
//animateletter();
//
break;//insertion operations
//case 2:
exit(0);
//
break;//deletion operations
//case 3: exit(0);
///
}
//}
void main(int argc,char **argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE| GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(1024.0,728.0);
glutInitWindowPosition(5.0,5.0);
glutCreateWindow("trial.cpp");
// glutReshapeFunc(myReshape);
glutDisplayFunc(displaypoint);
MyPoint();
glutIdleFunc(spinCube);
glutCreateMenu(menu_l);
glutAddMenuEntry("INSERT",1);
glutAddMenuEntry("DELETE",2);
glutAddMenuEntry("EXIT",3);
glutAttachMenu(GLUT_RIGHT_BUTTON);
/*glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glShadeModel(GL_SMOOTH);*/
//
//glutMouseFunc(mouse);
glutFullScreen();
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glutMainLoop();
}

You might also like