无法使用 rastertek 教程初始化 Direct3D
Cannot initialize Direct3D with rastertek tutorial
我对这个 rastertek 教程有疑问:http://www.rastertek.com/dx11s2tut03.html
问题发生在以下代码行
result = m_device->CreateRenderTargetView(backBufferPtr, NULL, &m_renderTargetView);
结果获得值 E_INVALIDARG One or more arguments are invalid.
我不知道会发生什么。有人可以帮我吗?我使用 visual studio 2015 社区版,HP Pavilion,Windows 8.1
谢谢
通过将 D3D11_CREATE_DEVICE_DEBUG
作为 Flags 参数传递给 D3D11CreateDeviceAndSwapChain
来启用 Direct3D 调试层:
// Create the swap chain, Direct3D device, and Direct3D device context.
result = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL,
D3D11_CREATE_DEVICE_DEBUG, &featureLevel, 1,
D3D11_SDK_VERSION, &swapChainDesc, &m_swapChain,
&m_device, NULL, &m_deviceContext);
if(FAILED(result))
{
return false;
}
这将启用额外的调试信息,这些信息应该会提示您在 E_INVALIDARG
.
之前出了什么问题
The Rastertek tutorials are quite old and make extensive use of deprecated APIs. I suggest taking a look at the Direct3D Game VS Template and the DirectX Tool Kit tutorials as your first introduction to Direct3D 11. Once you have the modern basics down, you can revisit the Rastertek tutorials and glean any additional information out of them.
疑难解答: 如果您在添加调试标志时遇到 D3D11CreateDeviceAndSwapChain
失败,您可能没有安装正确的调试设备——尽管它应该有已经由 VS 2015 安装处理。参见 this post。
我对这个 rastertek 教程有疑问:http://www.rastertek.com/dx11s2tut03.html
问题发生在以下代码行
result = m_device->CreateRenderTargetView(backBufferPtr, NULL, &m_renderTargetView);
结果获得值 E_INVALIDARG One or more arguments are invalid.
我不知道会发生什么。有人可以帮我吗?我使用 visual studio 2015 社区版,HP Pavilion,Windows 8.1
谢谢
通过将 D3D11_CREATE_DEVICE_DEBUG
作为 Flags 参数传递给 D3D11CreateDeviceAndSwapChain
来启用 Direct3D 调试层:
// Create the swap chain, Direct3D device, and Direct3D device context.
result = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL,
D3D11_CREATE_DEVICE_DEBUG, &featureLevel, 1,
D3D11_SDK_VERSION, &swapChainDesc, &m_swapChain,
&m_device, NULL, &m_deviceContext);
if(FAILED(result))
{
return false;
}
这将启用额外的调试信息,这些信息应该会提示您在 E_INVALIDARG
.
The Rastertek tutorials are quite old and make extensive use of deprecated APIs. I suggest taking a look at the Direct3D Game VS Template and the DirectX Tool Kit tutorials as your first introduction to Direct3D 11. Once you have the modern basics down, you can revisit the Rastertek tutorials and glean any additional information out of them.
疑难解答: 如果您在添加调试标志时遇到 D3D11CreateDeviceAndSwapChain
失败,您可能没有安装正确的调试设备——尽管它应该有已经由 VS 2015 安装处理。参见 this post。