コード例 #1
0
ファイル: Window.cpp プロジェクト: heropunch/cyberdeck
void Ibex::Window::renderCameraChooser() {
    glBindTexture(GL_TEXTURE_2D, 0);
    glDisable(GL_DEPTH_TEST);
    glColor4f(0,0.1,0,0.5);
    glBegin(GL_QUADS);
    glVertex3d(-0.1, 0.35, -0.25);
    glVertex3d(0.1, 0.35, -0.25);
    glVertex3d(0.1, 0.65, -0.25);
    glVertex3d(-0.1, 0.65, -0.25);
    glEnd();
    glColor4f(1,1,1,1);
    //    renderStrokeFontString(0, 0.5, -0.25, GLUT_STROKE_ROMAN, fpsString);
    renderBitmapString(-0.095, 0.64, -0.25, GLUT_BITMAP_HELVETICA_18, "~/Backspace: Back");
    //    renderBitmapString(-0.045, 0.53, -0.25, GLUT_BITMAP_HELVETICA_18, "2. ");
    char blah[256];
    uint startIndex = (selectedFile > 28/2) ? selectedFile-28/2 : 0;
    for(uint i = startIndex,index = 0; i < startIndex+28 && i < cameras.size(); ++i,++index) {
        sprintf(blah,"%d. Camera %d",i+1, cameras[i]);
        
        if(selectedFile == i) {
            glColor4f(1,1,0,1);
        }
        renderBitmapString(-0.095, 0.63-index*0.01, -0.25, GLUT_BITMAP_HELVETICA_18, blah);
        glColor4f(1,1,1,1);
    }
    renderBitmapString(0.055, 0.36, -0.25, GLUT_BITMAP_HELVETICA_18, fpsString);
    glEnable(GL_DEPTH_TEST);
}
コード例 #2
0
ファイル: q.c プロジェクト: ishaj/snake
void call3()
{
	renderBitmapString(1600,3500,(void *)font1,"YOUR TOTAL SCORE IS : ");
	array=int_char();
	renderBitmapString(2400,3500,(void *)font1,array);
	renderBitmapString(1600,3000,(void *)font1,"THANK YOU :)");
}
コード例 #3
0
ファイル: main.cpp プロジェクト: alexwardCS480/CS480Ward
//--Implementations
void render()
{
    int counter;
    //clear the screen
    glClearColor(1.0, 1.0, 1.0, 1.0); 
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    //enable the shader program
    glUseProgram(program);

    glUniform1f(loc_lightType, lightTypeVal);
    glUniform1f(loc_lightType2, lightTypeVal2);


    for(counter = 0; counter < globalObjCount; counter++)
    {
        //matrix MVP for planet    
        mvp = projection * view * objectsDataList.getModelMatrix(counter);

        // load each objects mvp
        renderObject( mvp, counter );
    }

    score();                      
  
    //Render Text
    string playerOneStr = "Player One Score:" + numToStr(scoreOne);
    string elapsedTime = "Elapsed Time:" + numToStr(elapsedDT());

    glColor3d(0.0, 0.0, 0.0);
    glMatrixMode(GL_PROJECTION);
    //glPushMatrix();
    glLoadIdentity();
    gluOrtho2D(0, w, 0, h);
    glScalef(1, -1, 1);
    glTranslatef(0, -h, 0);
    //glMatrixMode(GL_MODELVIEW);
    //glLoadIdentity();
    renderBitmapString(30,40,(void *)GLUT_BITMAP_HELVETICA_18,playerOneStr);
    glColor3d(0.0, 0.0, 0.0);
    renderBitmapString(30,60,(void *)GLUT_BITMAP_HELVETICA_18,elapsedTime);
    glPushMatrix();
    //glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
       

    //clean up
    glDisableVertexAttribArray(loc_position);
    glDisableVertexAttribArray(loc_uv);
    glDisableVertexAttribArray(loc_normal);

    //enable depth testing
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);

    //swap the buffers
    glutSwapBuffers();
}
コード例 #4
0
ファイル: main.cpp プロジェクト: pedroabgmarques/P3D
void renderScene2(int currentWindow)
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glPushMatrix();
	glColor3f(1.0, 0.0, 0.0);
	glTranslatef(x, y, z);
	glRotatef(180 - angle*180.0 / 3.14, 0.0, 1.0, 0.0);
	glutSolidCone(0.2, 0.8f, 4, 4);
	glPopMatrix();

	// Draw ground
	glColor3f(0.9f, 0.9f, 0.9f);
	glBegin(GL_QUADS);
	glVertex3f(-100.0f, 0.0f, -100.0f);
	glVertex3f(-100.0f, 0.0f, 100.0f);
	glVertex3f(100.0f, 0.0f, 100.0f);
	glVertex3f(100.0f, 0.0f, -100.0f);
	glEnd();

	// Draw 36 SnowMen
	// call the function that contains the rendering commands
	for (int i = -3; i < 3; i++)
	{
		for (int j = -3; j < 3; j++)
		{
			glPushMatrix();
			glTranslatef(i*10.0, 0, j*10.0);
			drawSnowMan();
			glPopMatrix();
		}
	}

	if (currentWindow == subWindow1)
	{
		frame++;
		time = glutGet(GLUT_ELAPSED_TIME);
		if (time - timebase > 1000) {
			sprintf(s, "FPS: %4.2f", frame*1000.0 / (time - timebase));
			timebase = time;
			frame = 0;
		}

		glColor3f(0.0, 1.0, 1.0);
		setOrthographicProjection();
		glPushMatrix();
		glLoadIdentity();
		renderBitmapString(30, 15, (void *)font, "IPCA - EDJG - P3D");
		renderBitmapString(30, 35, (void *)font, s);
		renderBitmapString(30, 55, (void *)font, "Esc - Quit");
		glPopMatrix();
		resetPerspectiveProjection();
	}

	glutSwapBuffers();
}
コード例 #5
0
ファイル: percolationgl.c プロジェクト: gwax/www-gwax
void renderSub1(void)	/*renders walker path display window*/
{
	int i,j;
	char buffer[255];

	glutSetWindow(subWindow1);	/*switch to sub window 1*/
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	/*draw stuff here*/
	glLoadIdentity();
	glColor3f(0.0,1.0,0.0);		/*first give some information*/
	sprintf(buffer, "Occupation probability %.5f on test %d of %d", p, currenttest, tests);
	renderBitmapString(-1.8,1.95,-5,GLUT_BITMAP_HELVETICA_12,buffer);
	sprintf(buffer, "cluster testing for radius of %d", r);
	renderBitmapString(-1.8,1.83,-5,GLUT_BITMAP_HELVETICA_12,buffer);
	sprintf(buffer, "running at %5.3f fps", fps);
	renderBitmapString(-1.8,1.71,-5,GLUT_BITMAP_HELVETICA_12,buffer);
	glTranslatef(0.0, 0.0, -3.0*r);	/*then draw the grid*/
	glTranslatef(-1.1*(r+1), -1.1*(r+1), 0);
    for(i=0; i<d; i++)
	{
		for(j=0; j<d; j++)
		{
			if((r+1-i)*(r+1-i)+(r+1-j)*(r+1-j) > r*r-1)	/*only in the radius*/
			{
				glColor3f(0.0, 0.0, 0.0);
			}
			else
			{
				switch(grid[i][j])	/*choose color based on status of cell*/
				{
				case -1:
					glColor3f(1.0, 0.0, 0.0);
					break;
				case 0:
					glColor3f(1.0, 1.0, 0.0);
					break;
				default:
					glColor3f(0.0, 1.0, 0.0);
				}
			}

			glBegin(GL_QUADS);	/*one square at a time*/
				glVertex3f( 0.5, 0.5, 0.5);
				glVertex3f(-0.5, 0.5, 0.5);
				glVertex3f(-0.5,-0.5, 0.5);
				glVertex3f( 0.5,-0.5, 0.5);
			glEnd();

			glTranslatef(1.1, 0.0, 0.0);
		}
		glTranslatef(-1.1*d, 1.1, 0.0);
	}

	glutSwapBuffers();	/*do the double buffer thing*/
}
コード例 #6
0
void concGame() {
	glViewport(width*0.1,height*.80,30,40);
		renderBitmapString("GAME OVER");
	glViewport(width*0.1,height*.770,30,40);
		renderBitmapString("Your helicopter crashed and will not be remembered");
	glViewport(width*0.1,height*.740,30,40);
		renderBitmapString("Thank you for playing HELICOPTER AVOID");
	glViewport(width*0.1,height*.71,30,40);
		renderBitmapString("You lasted: ");
	glViewport(width*0.1,height*.68,30,40);
		renderBitmapString("Press space to restart");
}
コード例 #7
0
ファイル: Fonts.cpp プロジェクト: zejdtc/Simple-Game-Engine
GLvoid Fonts::score_display(){
    glClearColor(0.8, 0.8, 0.8, 0.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glColor3f(1.0f, 0.0f, 0.0f);
    renderBitmapString(-0.1, 0.94, 0, GLUT_BITMAP_HELVETICA_18, "You Lose ! ");
    glutSwapBuffers();
}
コード例 #8
0
ファイル: backup4.cpp プロジェクト: anubhavmagic/Blocks-Game
// Display func for sub window 1
void renderScenesw1() {

	glutSetWindow(subWindow1);

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glLoadIdentity();
	gluLookAt(x, y, z,
		      x + lx,y + ly,z + lz,
			  0.0f,1.0f,0.0f);

	renderScene2();

	// display fps in the top window
 	frame++;

	time=glutGet(GLUT_ELAPSED_TIME);
	if (time - timebase > 1000) {
		sprintf(s,"Lighthouse3D - FPS:%4.2f",
			frame*1000.0/(time-timebase));
		timebase = time;
		frame = 0;
	}

	setOrthographicProjection();

	glPushMatrix();
	glLoadIdentity();
	renderBitmapString(5,30,0,GLUT_BITMAP_HELVETICA_12,s);
	glPopMatrix();
	restorePerspectiveProjection();

	glutSwapBuffers();
}
コード例 #9
0
ファイル: Fonts.cpp プロジェクト: zejdtc/Simple-Game-Engine
  GLvoid Fonts::sub_display(){
    
    glClearColor(0.8, 0.8, 0.8, 0.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glColor3f(0.5, 0.5, 0.5);
    renderBitmapString(-0.1, 0.94, 0, GLUT_BITMAP_HELVETICA_18, "Lizard Jump");
    glutSwapBuffers();
}
コード例 #10
0
ファイル: layer.cpp プロジェクト: asheikh91/repsnapper
void Layer::Draw(bool DrawVertexNumbers, bool DrawLineNumbers, 
		 bool DrawOutlineNumbers, bool DrawCPLineNumbers, 
		 bool DrawCPVertexNumbers, bool DisplayInfill) const 
{
  draw_polys(polygons, GL_LINE_LOOP, 1, 3, 1,0,0,1);
  draw_polys(polygons, GL_POINTS, 1, 3, 1,0,0,1);

  if(DrawOutlineNumbers)
    for(size_t p=0; p<polygons.size();p++)
      {
	ostringstream oss;
	oss << p;
	renderBitmapString(Vector3f(polygons[p].center.x, polygons[p].center.y, Z) , 
			   GLUT_BITMAP_8_BY_13 , oss.str());
      }

  draw_polys(shellPolygons, GL_LINE_LOOP, 1, 3, 1,1,.2,1);

  glColor4f(0.5,0.9,1,1);
  glLineWidth(1);
  double zs = Z;
  for(size_t s=0;s<skins;s++){
    for(size_t p=0;p<skinPolygons.size();p++)
      skinPolygons[p].draw(GL_LINE_LOOP,zs);
    zs-=thickness/skins;
  }

  draw_polys(fillPolygons, GL_LINE_LOOP, 1, 3, 1,1,1,1);
  draw_polys(supportPolygons, GL_LINE_LOOP, 3, 3, 0.5,0.5,1.0,1);
  draw_poly(hullPolygon, GL_LINE_LOOP, 3, 3, 0.8,0.6,0.0,0.5);
  draw_polys(bridgePolygons, GL_LINE_LOOP, 3, 3, 0.8,0.5,0.5,0.8);
  draw_polys(fullFillPolygons, GL_LINE_LOOP, 1, 3, 0.5,0.5,0.5,1);
  draw_polys(decorPolygons, GL_LINE_LOOP, 1, 3, 0.5,0.5,0.5,1);
  draw_polys(skinFullFillPolygons, GL_LINE_LOOP, 1, 3, 0.5,0.5,0.5,1);
  if(DisplayInfill)
    {
      if (normalInfill)
	draw_polys(normalInfill->infillpolys, GL_LINE_LOOP, 1, 3, 0.1,1,0.1,0.8);
      if (fullInfill)
	draw_polys(fullInfill->infillpolys, GL_LINE_LOOP, 1, 3, 0.1,1,0.1,0.8);
      if (decorInfill)
	draw_polys(decorInfill->infillpolys, GL_LINE_LOOP, 1, 3, 0.1,1,0.1,0.8);
      if (bridgeInfill)
	draw_polys(bridgeInfill->infillpolys, GL_LINE_LOOP, 1, 3, 0.8,0.3,0.1,0.8);
      if (supportInfill)
	draw_polys(supportInfill->infillpolys, GL_LINE_LOOP, 1, 3, 0.1,1,0.1,0.8);
      for(size_t s=0;s<skinFullInfills.size();s++) 
	draw_polys(skinFullInfills[s]->infillpolys, GL_LINE_LOOP, 3, 3, 0.2,1,0.2,0.6);
    }
  glLineWidth(1);  
  if(DrawCPVertexNumbers)
    for(size_t p=0; p<polygons.size();p++)
      polygons[p].drawVertexNumbers();
  
  if(DrawCPLineNumbers)
    for(size_t p=0; p<polygons.size();p++)
      polygons[p].drawLineNumbers();
}
コード例 #11
0
ファイル: Koch.cpp プロジェクト: amirsalah/cs2007
//
// Draw the scene
//
void DrawScene() 
{
	renderBitmapString(20, 20, GLUT_BITMAP_HELVETICA_18, "Press <- or -> ro rotate the object.");
	renderBitmapString(20, 40, GLUT_BITMAP_HELVETICA_18, "Repeatedly press will increase the rotating speed.");
	renderBitmapString(20, 60, GLUT_BITMAP_HELVETICA_18, "Press Esc to exit.ENJOY ^_^");
	if (PointsCounter == 3 && TurnLeft == true){
//		DrawTriangle();
/*		glBegin(GL_LINE_LOOP);
			glColor3f(0, 255, 255);
			glVertex2f(ClickedPoints[0][0], 480 - ClickedPoints[0][1]);
			glVertex2f(ClickedPoints[1][0], 480 - ClickedPoints[1][1]);
			glVertex2f(ClickedPoints[2][0], 480 - ClickedPoints[2][1]);
		glEnd();
*/		
		glLoadIdentity();
		glTranslatef(TriCenter[0], TriCenter[1], 0);
		glRotatef(-RotationAngle, 0.0, 0.0, 0.000001);
		glTranslatef(-TriCenter[0], -TriCenter[1], 0);
		sleepControl();
		DrawKoch(ClickedPoints[0], ClickedPoints[1], Pi/3, 4);
		DrawKoch(ClickedPoints[1], ClickedPoints[2], Pi/3, 4);
		DrawKoch(ClickedPoints[2], ClickedPoints[0], Pi/3, 4);
	}
	
	if (PointsCounter == 3 && TurnRight == true){
		glLoadIdentity();
		glTranslatef(TriCenter[0], TriCenter[1], 0);
		glRotatef(RotationAngle, 0.0, 0.0, 1.0);
		glTranslatef(-TriCenter[0], -TriCenter[1], 0);
		sleepControl();
		DrawKoch(ClickedPoints[0], ClickedPoints[1], Pi/3, 4);
		DrawKoch(ClickedPoints[1], ClickedPoints[2], Pi/3, 4);
		DrawKoch(ClickedPoints[2], ClickedPoints[0], Pi/3, 4);
	}
	
	if (PointsCounter == 3 && TurnRight == false && TurnLeft == false){
//		renderBitmapString(20, 20, GLUT_BITMAP_HELVETICA_18, "Press <- or -> ro rotate the object.");
// 		renderBitmapString(20, 40, GLUT_BITMAP_HELVETICA_18, "Repeatedly press will increase the rotating speed.");
//		renderBitmapString(20, 50, GLUT_BITMAP_HELVETICA_18, "Press Esc to exit.ENJOY ^_^");

		DrawKoch(ClickedPoints[0], ClickedPoints[1], Pi/3, 4);
		DrawKoch(ClickedPoints[1], ClickedPoints[2], Pi/3, 4);
		DrawKoch(ClickedPoints[2], ClickedPoints[0], Pi/3, 4);
	}		
}
コード例 #12
0
ファイル: main.cpp プロジェクト: namenu/SpecialTraning
static void drawFPS()
{
    glDisable(GL_TEXTURE_2D);
    
    char s[64];
    sprintf(s, "FPS: %.2f", current_fps);
    glColor3f(1, 1, 1);
    renderBitmapString(5, 5, GLUT_BITMAP_HELVETICA_12, s);
}
コード例 #13
0
ファイル: Window.cpp プロジェクト: heropunch/cyberdeck
void Ibex::Window::renderInfoWindow() {
    glBindTexture(GL_TEXTURE_2D, 0);
    glDisable(GL_DEPTH_TEST);
    glColor4f(0,0.1,0,0.5);
    glBegin(GL_QUADS);
    glVertex3d(-0.05, 0.45, -0.25);
    glVertex3d(0.05, 0.45, -0.25);
    glVertex3d(0.05, 0.55, -0.25);
    glVertex3d(-0.05, 0.55, -0.25);
    glEnd();
    glColor4f(1,1,1,1);
    renderBitmapString(-0.045, 0.54, -0.25, GLUT_BITMAP_HELVETICA_18, "1. Load Video");
    renderBitmapString(-0.045, 0.53, -0.25, GLUT_BITMAP_HELVETICA_18, "2. Load Stereo Video");
    renderBitmapString(-0.045, 0.52, -0.25, GLUT_BITMAP_HELVETICA_18, "3. Camera");
    renderBitmapString(-0.045, 0.51, -0.25, GLUT_BITMAP_HELVETICA_18, "4. Stereo Camera");
    //    renderStrokeFontString(0, 0.5, -0.25, GLUT_STROKE_ROMAN, fpsString);
    renderBitmapString(0.005, 0.465, -0.25, GLUT_BITMAP_HELVETICA_18, fpsString);
    glEnable(GL_DEPTH_TEST);
}
コード例 #14
0
ファイル: Billiards.cpp プロジェクト: prabhat246/Billiards
void board()
{

	if(w.x>81)
	{
		if((w.z<166.5 && w.z>3) || (w.z<-3 && w.z>-166.5))
		{w.xspeed = w.xspeed*-1;w.flag=1;r.flag=1;b.flag=1;}
		else {w.y=-5000; 
		glColor3f(1,0,0);
        renderBitmapString(0,0, GLUT_BITMAP_TIMES_ROMAN_24, "Foul");

	}
	}
	if(w.x<-81)
	{
		if((w.z<166.5 && w.z>3) || (w.z<-3 && w.z>-166.5))
		{w.xspeed = w.xspeed*-1;w.flag=1;r.flag=1;b.flag=1;}
		else { w.y=-5000;
		glColor3f(1,0,0);
		renderBitmapString(0,0, GLUT_BITMAP_TIMES_ROMAN_24, "Foul");
		 }
	}
	if(w.z>171)
	{
		if(w.x<77.5 && w.x>-77.5)
		{w.zspeed = w.zspeed*-1;w.flag=1;r.flag=1;b.flag=1;}
		else{ w.y=-5000;
		glColor3f(1,0,0);
		renderBitmapString(0,0, GLUT_BITMAP_TIMES_ROMAN_24, "Foul");
		 }
	}
	if(w.z<-171)
	{
		if(w.x<77.5 && w.x>-77.5)
		{w.zspeed = w.zspeed*-1;w.flag=1;r.flag=1;b.flag=1;}
		else { w.y=-5000;
		glColor3f(1,0,0);
		renderBitmapString(0,0, GLUT_BITMAP_TIMES_ROMAN_24, "Foul");
	}
	}

}
コード例 #15
0
void Poly::drawVertexNumbers() const
{
  Vector3d v;
  for (uint i=0;i < vertices.size();i++){
    v = getVertexCircular3(i);
    glVertex3f(v.x,v.y,v.z);
    ostringstream oss;
    oss << i;
    renderBitmapString(v, GLUT_BITMAP_8_BY_13 , oss.str());
  }
}
コード例 #16
0
void Poly::drawLineNumbers() const
{
  Vector3d v,v2;
  for (uint i=0;i < vertices.size();i++){
    v = getVertexCircular3(i);
    v2 = getVertexCircular3(i+1);
    ostringstream oss;
    oss << i;
    renderBitmapString((v+v2)/2., GLUT_BITMAP_8_BY_13 , oss.str());
  }
}
コード例 #17
0
ファイル: percolationgl.c プロジェクト: gwax/www-gwax
void renderSub2(void)	/*sub window for rms distance as a function of steps taken*/
{
	char buffer[255];

	glutSetWindow(subWindow2);	/*switch to sub window 2*/
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	/*draw stuff here*/
	glLoadIdentity();
	glColor3f(1.0,0.0,0.0);		/*display info about p sub c*/
	renderBitmapString(-1.75,1.9,-5,GLUT_BITMAP_HELVETICA_12,"p sub c is being estimated");
	renderBitmapString(-1.75,1.66,-5,GLUT_BITMAP_HELVETICA_12,"as the lowest occupation");
	renderBitmapString(-1.75,1.42,-5,GLUT_BITMAP_HELVETICA_12,"probability that results in");
	renderBitmapString(-1.75,1.18,-5,GLUT_BITMAP_HELVETICA_12,"a 50% chance of spanning");

	sprintf(buffer, "p sub c ~= %f", pc);
	renderBitmapString(-1.75,0.70,-5,GLUT_BITMAP_HELVETICA_12,buffer);
	
	glutSwapBuffers();	/*do the double buffer thing*/
}
コード例 #18
0
ファイル: main.cpp プロジェクト: ohmyitscasper/Theme7
void drawHUD()
{
  setOrthographicProjection();
  glColor3f(1.0-g_bgcolor.r,1.0-g_bgcolor.g,1.0-g_bgcolor.b);
  renderBitmapString( 4, g_display_controller.getWindowHeight()-20, 0.0, GLUT_BITMAP_HELVETICA_18, stringutils::convertToString(g_current_step*g_dt) ); 
  glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();

  assert( renderingutils::checkGLErrors() );
}
コード例 #19
0
ファイル: Billiards.cpp プロジェクト: prabhat246/Billiards
void blackboard()
{
		if(b.x>81)
		{
			if((b.z<166.5 && b.z>3) || (b.z<-3 && b.z>-166.5))
			{b.xspeed = b.xspeed*-1; w.flag=1;r.flag=1;b.flag=1;}
			else { b.y=-1500;
			glColor3f(1,0,0);
		    renderBitmapString(0,0, GLUT_BITMAP_TIMES_ROMAN_24, "GOAL!");
		 }
		}
	if(b.x<-81)
	{
		if((b.z<166.5 && b.z>3) || (b.z<-3 && b.z>-166.5))
		{b.xspeed = b.xspeed*-1; w.flag=1;r.flag=1;b.flag=1;}
		else{ b.y=-1500;
		glColor3f(1,0,0);
		renderBitmapString(0,0, GLUT_BITMAP_TIMES_ROMAN_24, "GOAL!");
	}
	}
	if(b.z>171)
	{
		if(b.x<77.5 && b.x>-77.5)
		{b.zspeed = b.zspeed*-1;w.flag=1;r.flag=1;b.flag=1;}
		else{ b.y=-1500;
		glColor3f(1,0,0);
		renderBitmapString(0,0, GLUT_BITMAP_TIMES_ROMAN_24, "GOAL!");
	}
	}
	if(b.z<-171)
	{
		if(b.x<77.5 && b.x>-77.5)
		{b.zspeed = b.zspeed*-1; w.flag=1;r.flag=1;b.flag=1;}
		else{ b.y=-1500;
		glColor3f(1,0,0);
	    renderBitmapString(0,0, GLUT_BITMAP_TIMES_ROMAN_24, "GOAL!");
	}
	}
}
コード例 #20
0
ファイル: main.cpp プロジェクト: flair2005/TDSmoke
void drawDescription() {
    setOrthographicProjection();
    glColor3d(1.0-g_simulation_ensemble->getBackgroundColor().r(),1.0-g_simulation_ensemble->getBackgroundColor().g(),1.0-g_simulation_ensemble->getBackgroundColor().b());
    
    std::string str(g_description);
    renderBitmapString( 20, 20, 0.0, GLUT_BITMAP_HELVETICA_18, str );
    
    glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();
    
    assert( renderingutils::checkGLErrors() );
}
コード例 #21
0
void gameover() {	

	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glViewport( 0, 0, width, height);
	glMatrixMode(GL_PROJECTION);
	
	glPushMatrix();
		glDisable(GL_LIGHTING); // disattiviamo le luci 
		glDisable(GL_DEPTH_TEST); // disabilitiamo z buffering 
		glDisable(GL_CULL_FACE); // disabilitiamo face culling 	
		
		glLoadIdentity();
		gluOrtho2D(0, width, 0, height);
		glMatrixMode(GL_MODELVIEW);
		
		glScalef(1.0,-1.0,1.0);
		glTranslatef(0.0,-height,0.0);
		
		// carico la texture
		glEnable(GL_TEXTURE_2D);
			glBindTexture(GL_TEXTURE_2D, g_textureArray[3]);   	
			glBegin(GL_QUADS);				
				//coordinate del quadrato "schermo"
				glTexCoord2f(0.0f, 1.0f); glVertex3f(0,0,0);
				glTexCoord2f(1.0f, 1.0f); glVertex3f(width,0,0);
				glTexCoord2f(1.0f, 0.0f); glVertex3f(width,height,0);
				glTexCoord2f(0.0f, 0.0f); glVertex3f(0,height,0);
			glEnd();
		glDisable(GL_TEXTURE_2D);
		
	// rendering scritta
	glColor3f(1.0f,1.0f,1.0f);
	glRasterPos2f(550, 650);
	if(glutGet(GLUT_ELAPSED_TIME)%1500>750)	
		renderBitmapString(GLUT_BITMAP_HELVETICA_18,"Press Esc to exit" );

		glTranslatef(0.0,height,0.0);
		glScalef(1.0,-1.0,1.0);
		
		glMatrixMode(GL_PROJECTION);
		glEnable(GL_LIGHTING); /* disattiviamo le luci */
		glEnable(GL_DEPTH_TEST); /* disabilitiamo z buffering */
		glEnable(GL_CULL_FACE); /* disabilitiamo face culling */
		//glColor3f(0.0f,0.0f,1.0f); //luce ambientale blu per una migliore visualizzazione
	glPopMatrix();	
	glutSwapBuffers();


}
コード例 #22
0
ファイル: text.cpp プロジェクト: Ziul/glmaze
    extern void renderText2dOrtho(float x, float y, int spacing, const char*pStr, ...)
    {
        char string[128];
        va_list valist; //info das variaveis
        va_start(valist, pStr); //inicia lista de argumentos das variaveis
        vsprintf(string, pStr, valist); // joga string formatado para string
        va_end(valist); // realiza operacoes de fato

        glDisable(GL_LIGHTING);
        setProjecaoOrto();
            renderBitmapString(x,y, spacing, font_glut, string);
        restauraProjecaoPerspectiva();
        glEnable(GL_LIGHTING);

    }
コード例 #23
0
void drawText() {
    // The tutorial at http://www.lighthouse3d.com/opengl/glut/index.php?bmpfontortho helped with this
    // Draw some text on the screen
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();

    // 2D orthographic with window's res
    gluOrtho2D(0, 1600, 1200, 0);
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    glLoadIdentity();
    // Needed for itoa - convert each int to char. Seriously, C++!? :-(
    char buffer [33];
    _itoa_s(lives, buffer, 10);

    if (win) {
        renderBitmapString(700,50,0,GLUT_BITMAP_TIMES_ROMAN_24,"//You win!//");
    }
    if (dead) {
        renderBitmapString(700,50,0,GLUT_BITMAP_TIMES_ROMAN_24,"//Game over! Click to restart.//");
    }
    if (intro) {
        renderBitmapString(700,50,0,GLUT_BITMAP_TIMES_ROMAN_24,"//Minesweeper//");
        renderBitmapString(600,80,0,GLUT_BITMAP_TIMES_ROMAN_24,"W A S D + mouse to move. Click to shoot. ");

    } else {
        std::string stringLives = "Lives: " + (std::string)buffer;
        _itoa_s(enemiesLeft, buffer, 10);
        std::string stringEnemiesLeft = "Enemies Left: " + (std::string)buffer;
        _itoa_s(level+1, buffer, 10);
        std::string stringLevel = "Level: " + (std::string)buffer;
//	char *lives = "Lives: 3";
//	char *enemiesLeft = "Enemies: 6" + (char)enemiesLeft;
//	char *level = "Level: 1";
        renderBitmapString(5,15,0,GLUT_BITMAP_HELVETICA_18,stringLives);
        renderBitmapString(5,30,0,GLUT_BITMAP_HELVETICA_18,stringEnemiesLeft);
        renderBitmapString(5,45,0,GLUT_BITMAP_HELVETICA_18,stringLevel);
    }
    glPopMatrix();



    glMatrixMode(GL_PROJECTION);
    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);



}
コード例 #24
0
ファイル: fps_test1.c プロジェクト: hammackj/playground
void player_position (void)
{
	char position[50];
	
	sprintf(position,"X = %f, Y = %f, Z = %f", xpos, ypos, zpos);
	
	setOrthographicProjection();
	//glDisable (GL_LIGHTING);
	glPushMatrix();
	glLoadIdentity();
	renderBitmapString(5,50,0,GLUT_BITMAP_HELVETICA_18, position);
	glPopMatrix();
	//glEnable (GL_LIGHTING);
	restorePerspectiveProjection();
	
}
コード例 #25
0
ファイル: Fonts.cpp プロジェクト: zejdtc/Simple-Game-Engine
  GLvoid Fonts::introduction_display(){
    
    glClearColor(0.8, 0.8, 0.8, 0.0);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glColor3f(1.0, 0.0, 0.0);
    renderBitmapString(-0.94, 0.9, 0, GLUT_BITMAP_HELVETICA_18
                       , "AirCrafts");
    renderBitmapString(-0.94, 0.7, 0, GLUT_BITMAP_HELVETICA_18
                       , "Eliminate all the enemies");
    renderBitmapString(-0.94, 0.5, 0, GLUT_BITMAP_HELVETICA_18
                       , "Do not hit the mountains");
    glColor3f(1.0, 1.0, 0);
    renderBitmapString(-0.94, 0.3, 0, GLUT_BITMAP_HELVETICA_18
                       , "Fire: 'F'");
    glColor3f(0.0, 0.0, 1.0);
    renderBitmapString(-0.94, 0.1, 0, GLUT_BITMAP_HELVETICA_18
                       , "Forward&Backward: 'W' & 'S' ");
    glColor3f(1.0, 0.0, 0.0);
    renderBitmapString(-0.94,-0.1, 0, GLUT_BITMAP_HELVETICA_18
                       , "Up&Down: 'Space' & 'Q' ");
    renderBitmapString(-0.94, -0.2, 0, GLUT_BITMAP_HELVETICA_18
                       , "Rotation: 'A' & 'D' ");
    renderBitmapString(-0.94, -0.4, 0, GLUT_BITMAP_HELVETICA_18
                       , "Zoom out: '5'");
    renderBitmapString(-0.94, 0.6, 0, GLUT_BITMAP_HELVETICA_18
                       ,  "Zoom in: '6'");
    
    //    if(isWin){
    //        glColor3f(0, 0, 1);
    //        renderBitmapString(0, -0.8, 0, GLUT_BITMAP_TIMES_ROMAN_24
    //                           , "YOU WIN!");
    //    }
    //    if(isLose){
    //        renderBitmapString(0, -0.8, 0, GLUT_BITMAP_TIMES_ROMAN_24
    //                           , "YOU LOSE!");
    //    }
    glutSwapBuffers();
}
コード例 #26
0
ファイル: main.cpp プロジェクト: flair2005/TDSmoke
void drawFPS() {
    setOrthographicProjection();
    glColor3d(1.0-g_simulation_ensemble->getBackgroundColor().r(),1.0-g_simulation_ensemble->getBackgroundColor().g(),1.0-g_simulation_ensemble->getBackgroundColor().b());
    
    std::string fpsStr;
    if (g_paused)
        fpsStr = "Paused";
    else
        fpsStr = stringutils::convertToString(g_fps,2) + " fps";
    renderBitmapString( 20, 20, 0.0, GLUT_BITMAP_HELVETICA_18, fpsStr );
    
    glMatrixMode(GL_PROJECTION);
	glPopMatrix();
	glMatrixMode(GL_MODELVIEW);
	glPopMatrix();
    
    assert( renderingutils::checkGLErrors() );
}
コード例 #27
0
ファイル: Collision.c プロジェクト: jpaulorio/Collision
/*
 * Draw all particles.
 */
static void DrawParticles()
{
	char text [50];
	int i;
	float sumSpeedx = 0;
	for (i = 0; i < PARTICLES_NUMBER; i++)
	{
		//sums all velocities from all particles. This sum should always be constant.
		sumSpeedx += abs(particles[i].vx) + abs(particles[i].vy) + abs(particles[i].vz);
		glPushMatrix();
		glTranslatef(particles[i].x, particles[i].y, particles[i].z);
		glColor3f(particles[i].r, particles[i].g, particles[i].b);
		glutSolidSphere(particles[i].radius, particles[i].slices, particles[i].stacks);
		glPopMatrix();
	}
	glColor3f(255.0, 255.0, 255.0);
	sprintf(text, "Speeds sum: %3.2f", sumSpeedx);
	renderBitmapString(BOX_SIZE, BOX_SIZE - 50, 0, GLUT_BITMAP_HELVETICA_10, text);
}
コード例 #28
0
void renderDisplayStart(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    gluLookAt(	0.0f, 0.0f, 10.0f,
			0.0f, 0.0f,  0.0f,
			0.0f, 1.0f,  0.0f);

    drawStart(0.0f);
    setOrthographicProjection();
    glPushMatrix();
    glLoadIdentity();
    glColor3f(0.0f, 0.0f, 1.0f);
    renderBitmapString(315,250,1,fontBitmap,(char *)"START");
    glPopMatrix();
    restorePerspectiveProjection();
    glutSwapBuffers();
}
コード例 #29
0
ファイル: TextInput.cpp プロジェクト: reiknight/ld22
void TextInput::render()
{
  glPushMatrix();
  glTranslatef(0,GAME_HEIGHT,0);
  if(editing)
    glColor3f(1,1,1);
  else
    glColor3f(0.7,0.7,0.7);
  glBegin(GL_QUADS);
    glVertex2f(x, y-h);
    glVertex2f(x+w, y-h);
    glVertex2f(x+w, y);
    glVertex2f(x, y);
  glEnd();
  
  glColor3f(0,0,0);
  renderBitmapString(x+25,y-20,GLUT_BITMAP_HELVETICA_12,value);
  
  glPopMatrix();

}
コード例 #30
0
ファイル: base.cpp プロジェクト: awang35/skyGesture
void calcFPS(){
	// Code to compute frames per second
	frame++;

	time=glutGet(GLUT_ELAPSED_TIME);
	if (time - timebase > 1000) {
		sprintf(s,"FPS:%4.2f",
			frame*1000.0/(time-timebase));
		timebase = time;
		frame = 0;
	}

	// Code to display a string (fps) with bitmap fonts
	setOrthographicProjection();

	glPushMatrix();
	glLoadIdentity();
	renderBitmapString(5,30,0,GLUT_BITMAP_TIMES_ROMAN_24,s);
	glPopMatrix();
	restorePerspectiveProjection();
}