为什么不能正常显示呢?
为什么没有显示到东西呢?
我原来没有使用DXUT的
现在只有黑色的一片,什么都没有
#include "head.h"#include "define.h"#include "DXUTsettingsdlg.h"#include "SDKmisc.h"#pragma warning(disable: 4995)#define WM_MOUSEWHEEL 0x020A//***************** Camera ********************************* CModelViewerCamera MyCamera;//***************** Model ********************************** Model_info *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(0,0,0), 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); 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, 1000.0f ); MyCamera.SetWindow( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height ); return S_OK;}void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext ){ if (pd3dDevice->BeginScene()) {//***************************************************** D3DXMATRIX world = *MyCamera.GetWorldMatrix() ; pd3dDevice->SetTransform(D3DTS_WORLD, &world) ; // Set view matrix D3DXMATRIX view = *MyCamera.GetViewMatrix() ; pd3dDevice->SetTransform(D3DTS_VIEW, &view) ; // Set projection matrix D3DXMATRIX proj = *MyCamera.GetProjMatrix() ; pd3dDevice->SetTransform(D3DTS_PROJECTION, &proj) ;//***************** Render **************************** model->Mesh->DrawSubset(0); pd3dDevice->SetTexture(0, model->texture); //***************** Render **************************** pd3dDevice->EndScene(); pd3dDevice->Present(NULL, NULL, NULL, NULL); }}void CALLBACK OnFrameMove( double fTime, float fElapsedTime, void* pUserContext ){ MyCamera.FrameMove( fElapsedTime );}