void drawWinner()
{
	float wSize;
	wSize=0.05*sin(4*count*M_PI/180)+0.5;
	glPushMatrix();
	glTranslated(width/8,height/2,0);
	glScalef(wSize,wSize,0);
	strokeString("WINNER");
	glPopMatrix();
}
void statePauseOn()
{
	drawPauseSpace();
	float angle=timeCount*(M_PI/180)*2;

	size=0.05*sin(angle)+0.55;
	double alpha=255*sin(angle)/2+255/2;

	glLineWidth(20);
	glPointSize(5);
	glColor4ub(255,50,50,alpha);
	glPushMatrix();
	glTranslated(3*width/8,height/2,0);
	glScalef(size,size,1);;
	strokeString("PAUSED");
	glPopMatrix();

	pauseIcons();

	timeCount++;
}
示例#3
0
void glutDisplay(){
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glClearColor(0.1f,0.23f,0.367f,0);

  glEnable(GL_DEPTH_TEST);

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(-2.0, 2.0, -2.0, 2.0, -2.0, 500.0);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glScalef(.001,.001,.001);
  glLineWidth(2.0);
  glColor3f(1.0f,1.0f,1.0f);
  strokeString(-1800.0f,1500.0f,gui_mode_msg.c_str());

  glLoadIdentity();
  glScalef(.002,.002,.002);
  glLineWidth(3.0);
  strokeString(-900.0f,0.0f,gui_gest_msg.substr(5).c_str());

  glLoadIdentity();
  glScalef(.001,.001,.001);
  glColor3f(0.93f,0.695f,0.066f);
  glLineWidth(2.0);
  strokeString(1300.0f,1500.0f,gui_logo_msg_1.substr(5).c_str());

  glLoadIdentity();
  glColor3f(0.93f,0.695f,0.066f);
  glScalef(.001,.001,.001);
  glLineWidth(2.0);
  strokeString(1470.0f,1350.0f,gui_logo_msg_2.substr(5).c_str());

  glLoadIdentity();
  glColor3f(1.0f,1.0f,1.0f);
  glScalef(.001,.001,.001);
  glLineWidth(2.0);
  strokeString(1100.0f,-1500.0f,("ESTOP:"+gui_estop_msg.substr(5)).c_str());

  glutSwapBuffers();

   //  glClear(GL_COLOR_BUFFER_BIT);
   //  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
   // glEnable(GL_BLEND);
   // glEnable(GL_LINE_SMOOTH);
   // glLineWidth(10.0);
   // output2(100, 100, "This is antialiased.");


    // glClear(GL_COLOR_BUFFER_BIT);
    // //要显示的字符
    // char *str = "current fps = ";
    // int n = strlen(str);
    // //设置要在屏幕上显示字符的起始位置
    // glRasterPos2i(0,0);
    // //逐个显示字符串中的每个字符
    // for (int i = 0; i < n; i++)
    //     glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18, *(str+i));
  

  // glClear(GL_COLOR_BUFFER_BIT);
  // glBegin(GL_TRIANGLES);
  // glVertex3f(-0.5,-0.5,0.0);
  // glVertex3f(0.5,0.0,0.0);
  // glVertex3f(0.0,0.5,0.0);
  // glEnd();
  // glFlush();
}
示例#4
0
void pauseIcons()
{	
	////////Play icon///////
	glPointSize(2);
	glColor3ub(200,0,0);

	pauseIconX[0]=3*width/9;
	pauseIconY[0]=3*height/8;

	drawColorBall(pauseIconX[0],pauseIconY[0],40);

	glColor4ub(0,0,0,40);
	glPointSize(4);
	drawCircle(pauseIconX[0],pauseIconY[0],40);

	glPointSize(2);
	glColor3ub(255,255,255);
	glPushMatrix();
	glTranslated(3*width/9-15,3*height/8,0);
	glRotated(-90,0,0,1);
	glBegin(GL_TRIANGLES);
	glVertex2d(35*sin(45*(M_PI/180)),0);
	glVertex2d(-35*cos(45*(M_PI/180)),0);
	glVertex2d(0,40);
	glEnd();
	glPopMatrix();

	////////////Restart Icon///////////

	glPointSize(2);
	glColor3ub(0,200,0);

	pauseIconX[1]=2*width/3;
	pauseIconY[1]=3*height/8;

	drawColorBall(pauseIconX[1],pauseIconY[1],40);

	glColor4ub(0,0,0,40);
	glPointSize(4);
	drawCircle(pauseIconX[1],pauseIconY[1],40);

	glLineWidth(8);
	glPointSize(5);
	glColor3ub(255,255,255);
	glPushMatrix();
	glTranslated(pauseIconX[1]-18,pauseIconY[1]-18,0);
	glScalef(0.5,0.5,1);
	strokeString("c");
	glPopMatrix();

	glLineWidth(8);
	glPointSize(4);
	glPushMatrix();
	glTranslated(pauseIconX[1]+10,pauseIconY[1]+10,0);
	glScalef(0.6,0.6,1);
	glRotated(-140,0,0,1);
	glBegin(GL_TRIANGLES);
	glVertex2d(20*sin(45*(M_PI/180)),0);
	glVertex2d(-20*cos(45*(M_PI/180)),0);
	glVertex2d(0,30);
	glEnd();
	glPopMatrix();

	///////////Return Icon////////////
	glPointSize(2);
	glColor3ub(204,0,204);

	pauseIconX[2]=width/2;
	pauseIconY[2]=height/8;

	drawColorBall(pauseIconX[2],pauseIconY[2],40);

	glColor4ub(0,0,0,40);
	glPointSize(4);
	drawCircle(pauseIconX[2],pauseIconY[2],40);

	glLineWidth(8);
	glPointSize(5);
	glColor3ub(255,255,255);
	glPushMatrix();
	glTranslated(pauseIconX[2]-25,pauseIconY[2]-5,0);
	glScalef(0.25,0.25,1);
	drawArrow();
	glPopMatrix();

	glLineWidth(4);
	glPointSize(2);
	glColor3ub(255,255,255);
	glPushMatrix();
	glTranslated(pauseIconX[2],pauseIconY[2],0);
	glScalef(1,1,1);
	glBegin(GL_LINES);
	glVertex2d(-10,20);
	glVertex2d(10,20);
	glVertex2d(10,20);
	glVertex2d(10,-20);
	glVertex2d(10,-20);
	glVertex2d(-10,-20);
	glVertex2d(-10,-20);
	glVertex2d(-10,20);
	glEnd();
	glPopMatrix();

}
示例#5
0
void calcScore()
{
	char score[7];
	glColor3ub(153,76,0);
	glBegin(GL_POLYGON);
	glVertex2d(width/2-150,height+100);
	glVertex2d(width/2+150,height+100);
	glVertex2d(width/2+150,height);
	glVertex2d(width/2-150,height);
	glEnd();

	glLineWidth(5);
	glColor4ub(0,0,0,200);
	/////////Boundarys///////
	glBegin(GL_LINES);
	glVertex2d(width/2-150,height+100);
	glVertex2d(width/2+150,height+100);
	glVertex2d(width/2+150,height+100);
	glVertex2d(width/2+150,height);
	glVertex2d(width/2+150,height);
	glVertex2d(width/2-150,height);
	glVertex2d(width/2-150,height);
	glVertex2d(width/2-150,height+100);
	glEnd();

	/////////Inner Boundarys//////////
	glBegin(GL_LINES);
	/////////Inner Boxes////////
	glVertex2d(width/2-100,height+75);
	glVertex2d(width/2+100,height+75);
	glVertex2d(width/2+100,height+75);
	glVertex2d(width/2+100,height+25);
	glVertex2d(width/2+100,height+25);
	glVertex2d(width/2-100,height+25);
	glVertex2d(width/2-100,height+25);
	glVertex2d(width/2-100,height+75);

	/////////Connecting Lines////////////
	glVertex2d(width/2-100,height+75);
	glVertex2d(width/2-150,height+100);
	glVertex2d(width/2+100,height+75);
	glVertex2d(width/2+150,height+100);
	glVertex2d(width/2+100,height+25);
	glVertex2d(width/2+150,height);
	glVertex2d(width/2-100,height+25);
	glVertex2d(width/2-150,height);
	glEnd();

	///////////Textures/////////
	//drawTexture();

	if(x[0]-radius>=width)
	{
		scoreLeft++;
	}
	if(x[0]+radius<=0)
		scoreRight++;
	
	score[0]=(char)(48+scoreLeft);
	score[1]=' ';
	score[2]='-';
	score[3]=' ';
	score[4]=(char)(48+scoreRight);
	score[5]='\0';

	glColor4ub(0,0,0,175);
	glLineWidth(5);
	glPointSize(2);
	glPushMatrix();
	glTranslated(455,height+40,0);
	glScalef(0.2,0.25,0);
    strokeString(score);
    glPopMatrix();
}
void winIcons()
{
	/////////Icon Restart///////

	glPointSize(2);
	glColor3ub(0,200,0);

	winIconX[0]=4*width/10;
	winIconY[0]=height/8;

	drawColorBall(winIconX[0],winIconY[0],40);

	glColor4ub(0,0,0,40);
	glPointSize(4);
	drawCircle(winIconX[0],winIconY[0],40);

	glLineWidth(8);
	glPointSize(5);
	glColor3ub(255,255,255);
	glPushMatrix();
	glTranslated(winIconX[0]-18,winIconY[0]-18,0);
	glScalef(0.5,0.5,1);
	strokeString("c");
	glPopMatrix();

	glLineWidth(8);
	glPointSize(4);
	glPushMatrix();
	glTranslated(winIconX[0]+10,winIconY[0]+10,0);
	glScalef(0.6,0.6,1);
	glRotated(-140,0,0,1);
	glBegin(GL_TRIANGLES);
	glVertex2d(20*sin(45*(M_PI/180)),0);
	glVertex2d(-20*cos(45*(M_PI/180)),0);
	glVertex2d(0,30);
	glEnd();
	glPopMatrix();

	/////////////Icon Return///////////
	glPointSize(2);
	glColor3ub(204,0,204);

	winIconX[1]=6*width/10;
	winIconY[1]=height/8;

	drawColorBall(winIconX[1],winIconY[1],40);

	glColor4ub(0,0,0,40);
	glPointSize(4);
	drawCircle(winIconX[1],winIconY[1],40);

	glLineWidth(8);
	glPointSize(5);
	glColor3ub(255,255,255);
	glPushMatrix();
	glTranslated(winIconX[1]-25,winIconY[1]-5,0);
	glScalef(0.25,0.25,1);
	drawArrow();
	glPopMatrix();

	glLineWidth(4);
	glPointSize(2);
	glColor3ub(255,255,255);
	glPushMatrix();
	glTranslated(winIconX[1],winIconY[1],0);
	glScalef(1,1,1);
	glBegin(GL_LINES);
	glVertex2d(-10,20);
	glVertex2d(10,20);
	glVertex2d(10,20);
	glVertex2d(10,-20);
	glVertex2d(10,-20);
	glVertex2d(-10,-20);
	glVertex2d(-10,-20);
	glVertex2d(-10,20);
	glEnd();
	glPopMatrix();

}
示例#7
0
void first()
{
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(0.75, 0.75, 0.75);
	strokeString(50, 850, 0.15, 0.15, "BANGALORE INSTITUTE OF TECHNOLOGY", 2);
	strokeString(100, 750, 0.3, 0.3, "DEPARTMENT OF COMPUTER SCIENCE", 4);
	strokeString(300, 670, 0.3, 0.3, "AND ENGINEERING", 4);
	strokeString(200, 500, 0.3, 0.3, "COMPUTER GRAPHICS PAKAGE ON", 2);
	glColor3f(0, 0.5, 0.5);
	strokeString(360, 420, 0.4, 0.4, "3D HOUSE", 6);
	glColor3f(0.54, 0, 0);
	strokeString(50, 50, 0.17, 0.17, "Press (Enter) to display the house", 2);
	strokeString(650, 200, 0.15, 0.15, "By:", 2);
	strokeString(650, 60, 0.15, 0.15, "Under the guidance of.", 2);
	glColor3f(0.74,0.72,0.42);
	strokeString(650, 160, 0.18, 0.18, "Girish Kumar.N", 2);
	strokeString(650, 30, 0.2, 0.2, "Girija.J (Associate Professor)", 2);
	strokeString(650, 120, 0.18, 0.18, "1BI13CS057", 2);
	glutSwapBuffers();
}