當前位置: 首頁>>代碼示例>>C++>>正文


C++ Billboard::Draw方法代碼示例

本文整理匯總了C++中Billboard::Draw方法的典型用法代碼示例。如果您正苦於以下問題:C++ Billboard::Draw方法的具體用法?C++ Billboard::Draw怎麽用?C++ Billboard::Draw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Billboard的用法示例。


在下文中一共展示了Billboard::Draw方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: Draw

void DemoState::Draw()
{

	Game::iterator it = Game::iterator("Camera");
	if (!it.seekName("DemoCam"))
	{
		assert(0);
	}
	GameObject* GO = it;
	((Camera*)GO)->Use();
	Game::instance()->DrawObjects();
	timer += DisplayManager::instance()->getDtSecs();
	if (timer < 0)
	{
		glDisable(GL_DEPTH_TEST);
		glDepthMask(GL_FALSE);
		glMatrixMode(GL_PROJECTION);
		GLfloat f[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
		glGetFloatv(GL_PROJECTION_MATRIX,f);
		glLoadIdentity();
		glMatrixMode(GL_MODELVIEW);
		glLoadIdentity();

		Splash->UseThisTexture();
		Billboard b;
		b.Draw();
		Splash->UseNoTexture();
		glEnable(GL_DEPTH_TEST);
		glDepthMask(GL_TRUE);
		glMatrixMode(GL_PROJECTION);
		glLoadMatrixf(f);

	}
	if (timer > 1)
	{
		timer = -1;
	}



}
開發者ID:VileLasagna,項目名稱:WarpDrive,代碼行數:41,代碼來源:DemoState.cpp

示例2: drawScene

void drawScene()
{// covert speed to string
	string speedword = to_string(speed);

	string SpeedPhrase = "Speed: ";
	SpeedPhrase.append(speedword);
	string Direction = "Direction: ";
	Direction.append(carHeading);
	glColor3f(1, 0, 0);
	//print words
	glWindowPos2i((winWidth / 2) -125, winHeight - (sHeight*1.2));
	printString(SpeedPhrase);
	glWindowPos2i((winWidth / 2) + 75, winHeight - (sHeight*1.2));
	printString(Direction);


	// Draw terrain
	glCallList(terrainID);

	glEnable(GL_LIGHTING);
	trafficLight.setMaterials();
	
	/*vector<string> test;
	test=trafficLight.GetMaterialNames();
	for (int i = 0; i < test.size(); i++)
		cout << "name: " << test[i] << endl;*/
	// North-East (NS_Signal)
	glPushMatrix();
	glTranslatef(10, 0, -10.5);
	glScalef(1/3.28/12, 1/3.28/12, 1/3.28/12);
	trafficLight.setSignal(NS_Signal);
	trafficLight.Draw();
	glPopMatrix();
	
	
	glPushMatrix();
	glTranslatef(10, 0, -10);
	glRotatef(-45, 0, 1, 0);
	glCallList(surveillanceCameraID);
	glPopMatrix();

	// North-West (WE_Signal)
///board 1
	//glColor3f(1, 1, 0);
	glPushMatrix();
	board.Draw();
	glPopMatrix();
// board 2
	glPushMatrix();
	board2.Draw();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-10, 0, -10.5);
	glScalef(1 / 3.28 / 12, 1 / 3.28 / 12, 1 / 3.28 / 12);
	glRotatef(90, 0, 1, 0);
	trafficLight2.setSignal(WE_Signal);
	trafficLight2.Draw();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-10, 0, -10);
	glRotatef(45, 0, 1, 0);
	glCallList(surveillanceCameraID);
	glPopMatrix();
	
	// South-East (WE_Signal)
	glPushMatrix();
	glTranslatef(10, 0, 10);
	glScalef(1 / 3.28 / 12, 1 / 3.28 / 12, 1 / 3.28 / 12);
	glRotatef(-90, 0, 1, 0);
	trafficLight3.setSignal(WE_Signal);
	trafficLight3.Draw();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(10, 0, 10.5);
	glRotatef(-135, 0, 1, 0);
	glCallList(surveillanceCameraID);
	glPopMatrix();

	// South West(SN_Signal)
	glPushMatrix();
	glTranslatef(-10, 0, 10);
	glScalef(1 / 3.28 / 12, 1 / 3.28 / 12, 1 / 3.28 / 12);
	glRotatef(180, 0, 1, 0);
	trafficLight4.setSignal(NS_Signal);
	trafficLight4.Draw();
	glPopMatrix();

	glPushMatrix();
	glTranslatef(-10, 0, 10.5);
	glRotatef(135, 0, 1, 0);
	glCallList(surveillanceCameraID);
	glPopMatrix();

	// Draw the car.
	glPushMatrix();
	glTranslatef(carPosition.x, carPosition.y, carPosition.z);
	glRotatef(carDirection, 0, 1, 0);
//.........這裏部分代碼省略.........
開發者ID:rhaye012,項目名稱:Reginald-Hayes-Code-sample,代碼行數:101,代碼來源:main.cpp


注:本文中的Billboard::Draw方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。