大号"To fix call CDXUTDialog::Init() first. See comments for details."
L"To fix call CDXUTDialog::Init() first. See comments for details."
调用回调函数 DXUTCreateDevice() 后,DXUTgui.cpp 断言检查返回错误。断言说先调用 CDXUTDialog::Init() 但我应该把它放在 WinMain() 的什么地方?
将您的 DXUT 客户端代码与 EmptyProject and SimpleSample--assuming you are using the DXUT11 from GitHub 的内容进行比较。
典型的模式是为 CDXUTDialogResourceManager
创建一个全局变量,然后在从 DXUTCreateDevice
[=17= 获得回调之前从 InitApp
调用 CDXUTDialog::Init
]
int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow )
{
// Enable run-time memory check for debug builds.
#ifdef _DEBUG
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
// DXUT will create and use the best device
// that is available on the system depending on which D3D callbacks are set below
// Set DXUT callbacks
DXUTSetCallbackMsgProc( MsgProc );
DXUTSetCallbackKeyboard( OnKeyboard );
DXUTSetCallbackFrameMove( OnFrameMove );
DXUTSetCallbackDeviceChanging( ModifyDeviceSettings );
DXUTSetCallbackD3D11DeviceAcceptable( IsD3D11DeviceAcceptable );
DXUTSetCallbackD3D11DeviceCreated( OnD3D11CreateDevice );
DXUTSetCallbackD3D11SwapChainResized( OnD3D11ResizedSwapChain );
DXUTSetCallbackD3D11SwapChainReleasing( OnD3D11ReleasingSwapChain );
DXUTSetCallbackD3D11DeviceDestroyed( OnD3D11DestroyDevice );
DXUTSetCallbackD3D11FrameRender( OnD3D11FrameRender );
InitApp(); <-- // THIS IS WHERE DXUT GUI WIDGETS GET INITIALIZED, BEFORE THE WINDOW OR DEVICE IS CREATED
DXUTInit( true, true, nullptr ); // Parse the command line, show msgboxes on error, no extra command line params
DXUTSetCursorSettings( true, true );
DXUTCreateWindow( L"SimpleSample11" );
// Only require 10-level hardware, change to D3D_FEATURE_LEVEL_11_0 to require 11-class hardware
// Switch to D3D_FEATURE_LEVEL_9_x for 10level9 hardware
DXUTCreateDevice( D3D_FEATURE_LEVEL_10_0, true, 800, 600 );
DXUTMainLoop(); // Enter into the DXUT render loop
return DXUTGetExitCode();
}
Starting a new project using DXUT is not recommended. It's really intended only for maintaining existing code that has dependencies on DXUT while removing dependencies on D3DX11 and other legacy DirectX SDK content. The vast majority of DXUT's functionality is complete overkill for most applications. It's also buggy and really only intended for samples.
调用回调函数 DXUTCreateDevice() 后,DXUTgui.cpp 断言检查返回错误。断言说先调用 CDXUTDialog::Init() 但我应该把它放在 WinMain() 的什么地方?
将您的 DXUT 客户端代码与 EmptyProject and SimpleSample--assuming you are using the DXUT11 from GitHub 的内容进行比较。
典型的模式是为 CDXUTDialogResourceManager
创建一个全局变量,然后在从 DXUTCreateDevice
[=17= 获得回调之前从 InitApp
调用 CDXUTDialog::Init
]
int WINAPI wWinMain( _In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow )
{
// Enable run-time memory check for debug builds.
#ifdef _DEBUG
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
// DXUT will create and use the best device
// that is available on the system depending on which D3D callbacks are set below
// Set DXUT callbacks
DXUTSetCallbackMsgProc( MsgProc );
DXUTSetCallbackKeyboard( OnKeyboard );
DXUTSetCallbackFrameMove( OnFrameMove );
DXUTSetCallbackDeviceChanging( ModifyDeviceSettings );
DXUTSetCallbackD3D11DeviceAcceptable( IsD3D11DeviceAcceptable );
DXUTSetCallbackD3D11DeviceCreated( OnD3D11CreateDevice );
DXUTSetCallbackD3D11SwapChainResized( OnD3D11ResizedSwapChain );
DXUTSetCallbackD3D11SwapChainReleasing( OnD3D11ReleasingSwapChain );
DXUTSetCallbackD3D11DeviceDestroyed( OnD3D11DestroyDevice );
DXUTSetCallbackD3D11FrameRender( OnD3D11FrameRender );
InitApp(); <-- // THIS IS WHERE DXUT GUI WIDGETS GET INITIALIZED, BEFORE THE WINDOW OR DEVICE IS CREATED
DXUTInit( true, true, nullptr ); // Parse the command line, show msgboxes on error, no extra command line params
DXUTSetCursorSettings( true, true );
DXUTCreateWindow( L"SimpleSample11" );
// Only require 10-level hardware, change to D3D_FEATURE_LEVEL_11_0 to require 11-class hardware
// Switch to D3D_FEATURE_LEVEL_9_x for 10level9 hardware
DXUTCreateDevice( D3D_FEATURE_LEVEL_10_0, true, 800, 600 );
DXUTMainLoop(); // Enter into the DXUT render loop
return DXUTGetExitCode();
}
Starting a new project using DXUT is not recommended. It's really intended only for maintaining existing code that has dependencies on DXUT while removing dependencies on D3DX11 and other legacy DirectX SDK content. The vast majority of DXUT's functionality is complete overkill for most applications. It's also buggy and really only intended for samples.