Examples: DirectX10,DirectX11: Moved call to OMSetRenderTargets() in main loop so example code can integrate more nicely with other code.

This commit is contained in:
omar 2017-12-25 14:54:54 +01:00
parent 8d54b1b7af
commit 78f48bb795
2 changed files with 2 additions and 2 deletions

View File

@ -27,7 +27,6 @@ void CreateRenderTarget()
render_target_view_desc.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D; render_target_view_desc.ViewDimension = D3D10_RTV_DIMENSION_TEXTURE2D;
g_pSwapChain->GetBuffer(0, __uuidof(ID3D10Texture2D), (LPVOID*)&pBackBuffer); g_pSwapChain->GetBuffer(0, __uuidof(ID3D10Texture2D), (LPVOID*)&pBackBuffer);
g_pd3dDevice->CreateRenderTargetView(pBackBuffer, &render_target_view_desc, &g_mainRenderTargetView); g_pd3dDevice->CreateRenderTargetView(pBackBuffer, &render_target_view_desc, &g_mainRenderTargetView);
g_pd3dDevice->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL);
pBackBuffer->Release(); pBackBuffer->Release();
} }
@ -196,6 +195,7 @@ int main(int, char**)
} }
// Rendering // Rendering
g_pd3dDevice->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL);
g_pd3dDevice->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_color); g_pd3dDevice->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_color);
ImGui::Render(); ImGui::Render();

View File

@ -27,7 +27,6 @@ void CreateRenderTarget()
render_target_view_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; render_target_view_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
g_pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer); g_pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);
g_pd3dDevice->CreateRenderTargetView(pBackBuffer, &render_target_view_desc, &g_mainRenderTargetView); g_pd3dDevice->CreateRenderTargetView(pBackBuffer, &render_target_view_desc, &g_mainRenderTargetView);
g_pd3dDeviceContext->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL);
pBackBuffer->Release(); pBackBuffer->Release();
} }
@ -199,6 +198,7 @@ int main(int, char**)
} }
// Rendering // Rendering
g_pd3dDeviceContext->OMSetRenderTargets(1, &g_mainRenderTargetView, NULL);
g_pd3dDeviceContext->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_color); g_pd3dDeviceContext->ClearRenderTargetView(g_mainRenderTargetView, (float*)&clear_color);
ImGui::Render(); ImGui::Render();