为什么我渲染出来的是黑色的呢?
#include "head.h"#include "define.h"#include "DXUTsettingsdlg.h"#include "SDKmisc.h"#include "SDKmesh.h"#pragma warning(disable: 4995)#define WM_MOUSEWHEEL 0x020A//***************** Camera ********************************* CModelViewerCamera MyCamera;//***************** Camera ********************************* //Model_info *model; CDXUTXFileMesh model;using namespace std;int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){//*********************************************** DXUTSetCallbackD3D9DeviceCreated( OnCreateDevice ); DXUTSetCallbackD3D9FrameRender( OnFrameRender ); DXUTSetCallbackMsgProc( MsgProc ); DXUTSetCallbackFrameMove( OnFrameMove ); DXUTInit( true, true ); // Parse the command line and show msgboxes DXUTCreateWindow( L"G" ); DXUTCreateDevice( true, 1024, 768 ); DXUTMainLoop();//***************** Wait Message ********************* return DXUTGetExitCode();}LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing, void* pUserContext ){ MyCamera.HandleMessages( hWnd, uMsg, wParam, lParam ); return 0;}HRESULT CALLBACK OnCreateDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext ){ //pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255,255,255), 1.0f, 0); //model = LoadModel_Texture(L"I:\\I disk\\可移动磁盘 (L)\\3DS文件转换为X文件\\conv3ds\\test.x", L"I:\\I disk\\可移动磁盘 (L)\\3DS文件转换为X文件\\conv3ds\\Serah.jpg", pd3dDevice); model.Create(pd3dDevice, L"I:\\I disk\\可移动磁盘 (L)\\3DS文件转换为X文件\\conv3ds\\test.x"); D3DXVECTOR3 eyePt(0.0f, 0.0f, 50.0f); D3DXVECTOR3 lookAt(0.0f, 0.0f, 0.0f); MyCamera.SetViewParams(&eyePt, &lookAt); float fAspectRatio = pBackBufferSurfaceDesc->Width / ( FLOAT )pBackBufferSurfaceDesc->Height; MyCamera.SetProjParams( D3DX_PI / 4, fAspectRatio, 0.1f, 10000.0f ); MyCamera.SetWindow( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height ); return S_OK;}void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext ){ HRESULT hr; V( pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB( 255,255,255 ), 1.0f, 0 ) ); if (SUCCEEDED(pd3dDevice->BeginScene())) { D3DXMATRIX world = *MyCamera.GetWorldMatrix() ; V(pd3dDevice->SetTransform(D3DTS_WORLD, &world)) ; D3DXMATRIX view = *MyCamera.GetViewMatrix() ; V(pd3dDevice->SetTransform(D3DTS_VIEW, &view)) ; D3DXMATRIX proj = *MyCamera.GetProjMatrix() ; V(pd3dDevice->SetTransform(D3DTS_PROJECTION, &proj)) ;//**********************Rendering**************************** model.Render(pd3dDevice); pd3dDevice->EndScene(); }}void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext ){ MyCamera.FrameMove( fElapsedTime );}