锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
{
涓錛氭敞鍐岀獥鍙g被
浜岋細鍒涘緩紿楀彛
涓夛細If(鍒濆鍖?/span>D3D鎴愬姛InitD3D( hWnd ))
{
鍥涳細杞藉叆3DS 妯″瀷Load3DSModel();
浜旓細if(鍒涘緩綰圭悊鎴愬姛CreateTexture())
{
鍏細if(鍒濆鍖栭《鐐瑰拰绱㈠紩緙撳啿鎴愬姛InitVB() and InitIB())
{涓冿細鏄劇ず騫舵洿鏂扮獥鍙?/span>
ShowWindow( hWnd, SW_SHOWDEFAULT );
UpdateWindow( hWnd );}
鍏細娑堟伅寰幆
鏈夋秷鎭鐞嗘秷鎭紱
娌℃湁娑堟伅澶勭悊鍒欒皟鐢?/span>render()鍑芥暟
while( msg.message!=WM_QUIT ) //褰撴湁娑堟伅鐨勬椂鍊欏鐞嗘秷鎭垎鍙戞秷鎭病鏈夋秷鎭殑鏃跺?/span>
{
// 娑堟伅闃熷垪涓湁娑堟伅鏃訛紝璋冪敤鐩稿簲鐨勫鐞嗚繃紼?/span>
if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
// 濡傛灉娌℃湁闇瑕佸鐞嗙殑娑堟伅錛岃皟鐢?/span>Render()鍑芥暟
Render();
}
}
}
涔濓細鍒犻櫎娉ㄥ唽鐨勭被
UnregisterClass( "D3D Tutorial", wc.hInstance );
}
鍒濆鍖?/span>D3D:
// 鍒涘緩涓涓?/span>D3D瀵硅薄,鐢ㄦ潵鍒涘緩璁懼
if( NULL == ( g_pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) )
return E_FAIL;
The Direct3D object is the first object that your application creates and the last object that your application releases.
//緇欒澶囩粨鏋勪綋鍙傛暟璧嬪煎悗錛岀敤D3D瀵硅薄鍒涘緩璁懼銆?/span>
//璁劇疆娓叉煋鐘舵?/span>
g_pd3dDevice->SetRenderState(,)