Game Development Reference
In-Depth Information
clear. We won't use the stencil buffer, so we will just clear the depth buffer using
D3D11_CLEAR_DEPTH , and leave the default of 0 for the stencil value.
The auto keyword is a new addition to C++ in the C++11 specifi cation. It allows the
compiler to determine the data type, instead of requiring the programmer to specify
it explicitly.
auto rtvs = m_renderTargetView.Get();
m_d3dContext->OMSetRenderTargets(
1,
&rtvs,
m_depthStencilView.Get()
);
const float clearCol[4] = { 0.0f, 0.0f, 0.0f,
1.0f };
m_d3dContext->ClearRenderTargetView(
rtvs,
clearCol
);
m_d3dContext->ClearDepthStencilView(
m_depthStencilView.Get(),
D3D11_CLEAR_DEPTH,
1.0f,
0);
You'll notice that aside from clearing the depth buffer, we're also setting some render
targets at the start. This is because in Windows 8 the render target is unbound when
we present the frame, so at the start of the new frame we need to rebind the render
target so that the GPU has somewhere to draw to.
Now that we have a clean slate, we can start rendering the world. We'll get into this
in the next chapter, but this is where we will draw our textures onto the screen to
create the world. The user interface is also drawn at this point, and once this stage
is complete you should end up with the finished frame, ready for display.
Search WWH ::




Custom Search