Esempio n. 1
0
//change pose
void Robot::move(){
    
    if (dMode == 1) {
        display1();
    } else if (dMode == 2){
        display2();
    } else if (dMode == 3){
        display3();
    }
    
}
Esempio n. 2
0
void main()
{
	init_1602();
	init_24c02();
	init();
	readtemp();
	EA=1;
	ET0=1;
	TR0=0;
	while(1)
	{
		keyscan();
		if(second==0)
		{
			if(ahour==hour&&amin==minute)
			{
				display3();
				alarmflag=1;
				beep=0;
				while(alarmflag==1)
				{
					if(k1==0||k2==0||k3==0||k4==0)
					{
						alarmflag=0;
						write_com(0x01);
						beep=1;
						while(k1==0||k2==0||k3==0||k4==0);
					}
				}
			}
		}
		if(flag==0&&k3==0)
		{
			display4();
		}
		if(flag==0&&alarmflag==0)
		{
			display1();
		}
		if(flag==1&&alarmflag==0)
		{
			display2();
		}
	}
} 
void display2()
{    
   glClearColor(0.6, 0.75, 0.85, 1); // sky color is light blue
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glWindowPos2i(250,500);
	  //  Enable Z-buffering in OpenGL
   glEnable(GL_DEPTH_TEST);
   glCullFace(GL_BACK);
  
   glLoadIdentity();
    
   // Set the look at position for perspective projection
      		gluLookAt(
			Ex,      Ey,      Ez,
			Ex + lx, Ey, Ez+lz,
			0.0,    1,    0.0);
	Print("Select car :",1);
	glWindowPos2i(250,450);
	Print("1. Mercedes Benz",1);
	glWindowPos2i(250,400);
	Print("2. Ferrari California ",1);

	if(opt==1)
	{
		display3();
	}
	else if(opt==2)
	{
		display4();
	}
		glEnable(GL_TEXTURE_2D);
   glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
   glColor3f(1,1,1);
   glBindTexture(GL_TEXTURE_2D,texture[7]);
   glBegin(GL_QUADS);                
   glColor3f(1,1,1); 
   glNormal3f( 0, 0, 1);
   glTexCoord2f(0,0);glVertex3f(-1200,-1000,200);
   glTexCoord2f(1,0);glVertex3f(+1200,-1000,200);
   glTexCoord2f(1,1);glVertex3f(+1200,+1000,200);
   glTexCoord2f(0,1);glVertex3f(-1200,+1000,200);
   glEnd();
   glDisable(GL_TEXTURE_2D);
}
Esempio n. 4
0
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
if(flag==0)
{

	glRasterPos3f(58,58,0);
for(i=0;s[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s[i]);
glRasterPos3f(45,450,0);
for(i=0;s1[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s1[i]);
glRasterPos3f(90,358,0);
for(i=0;s2[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s2[i]);
glRasterPos3f(70,338,0);
for(i=0;s3[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s3[i]);
glRasterPos3f(218,218,0);
for(i=0;s4[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s4[i]);
glRasterPos3f(350,218,0);
for(i=0;s5[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s5[i]);
glRasterPos3f(250,150,0);
for(i=0;s6[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s6[i]);
glColor3f(1.0,1.0,0.0);
glRasterPos3f(250,130,0);
for(i=0;s7[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s7[i]);
glRasterPos3f(250,100,0);
for(i=0;s8[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s8[i]);
glRasterPos3f(58,28,0);
for(i=0;s9[i]!='\0';i++) 
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24,s9[i]);




}
else
{

	road();
mountain();


	
//green
glBegin(GL_POLYGON);
glColor3f(0.0,1.0,0.0);
	glVertex2i(-10,300);
	glVertex2i(645,310);
   	glVertex2i(940,100);
	glVertex2i(-10,100);
glEnd();


trees();


//plane construction

glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1,1,1);
glBegin(GL_POLYGON);//rectangular body
glVertex2f(0.0,30.0);
glVertex2f(0.0,55.0);
glVertex2f(135.0,55.0);
glVertex2f(135.0,30.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1.0,1.0,1.0);
glBegin(GL_POLYGON);//upper triangle construction plane
glVertex2f(135.0,55.0);
glVertex2f(150.0,50.0);
glVertex2f(155.0,45.0);
glVertex2f(160.0,40.0);
glVertex2f(135.0,40.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(0.0,0.0,0.0);
glBegin(GL_LINE_LOOP);//outline of upper triangle plane
glVertex2f(135.0,55.0);
glVertex2f(150.0,50.0);
glVertex2f(155.0,45.0);
glVertex2f(160.0,40.0);
glVertex2f(135.0,40.0);
glEnd();
glPopMatrix();


glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);//lower triangle
glVertex2f(135.0,40.0);
glVertex2f(160.0,40.0);
glVertex2f(160.0,37.0);
glVertex2f(145.0,30.0);
glVertex2f(135.0,30.0);
glEnd();
glPopMatrix();


glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);//back wing 
glVertex2f(0.0,55.0);
glVertex2f(0.0,80.0);
glVertex2f(10.0,80.0);
glVertex2f(40.0,55.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);//left side wing
glVertex2f(65.0,55.0);
glVertex2f(50.0,70.0);
glVertex2f(75.0,70.0);
glVertex2f(90.0,55.0);
glEnd();
glPopMatrix();

glPushMatrix();
glTranslated(a,c,0.0);
glColor3f(1.0,0.0,0.0);
glBegin(GL_POLYGON);//rightside wing
glVertex2f(70.0,40.0);
glVertex2f(100.0,40.0);
glVertex2f(80.0,15.0);
glVertex2f(50.0,15.0);

glEnd();

glPopMatrix();



	if(c>390)    //timer to jump to next display
{
	display2();
	d+=5;//plane takeoff on x in 2nd display
}

if(a>500.0)//window position during take off
{
	a=0.0;
	b=0.0;
}

if(c>800)//timer to jump to 3rd display
{
	display3();
	e+=5;//plane takeoff on x in 3rd display
	
	if(e>250)//timer to call blast function
	{
		blast();
		e=250;
	}
}

}

glFlush();
glutSwapBuffers();
}