Beispiel #1
0
void Render()
{
	if(g_pD3DDevice==NULL) return;

	//Clear the back buffer to a black color
	g_pD3DDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);

	//Begin the scene
	g_pD3DDevice->BeginScene();

	SetupRotation();
	SetupCamera();
	SetupPerspective();

	//Rendering triangles
	int triCount=0;
	g_pD3DDevice->SetStreamSource(0, g_pVertexBuffer, 0, sizeof(CUSTOMVERTEX));
	g_pD3DDevice->SetFVF(D3DFVF_CUSTOMVERTEX);
	triCount+=g_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);

	char msg[256];
	sprintf(msg, "每桢渲染的三角形数:%d", triCount);
	g_pFont->DrawText(msg, 5, 5, D3DCOLOR_XRGB(0, 255, 0));

	//End the scene
	g_pD3DDevice->EndScene();

	//Flip
	g_pD3DDevice->Present(NULL, NULL, NULL, NULL);
}
Beispiel #2
0
void CFuncPlatRot::Spawn( void )
{
	CFuncPlat::Spawn();
	SetupRotation();
}