Commit 85bff2d8 authored by chili's avatar chili
Browse files

set render target and viewport

parent 50b40da5
...@@ -131,7 +131,7 @@ void Graphics::DrawTestTriangle() ...@@ -131,7 +131,7 @@ void Graphics::DrawTestTriangle()
// Bind vertex buffer to pipeline // Bind vertex buffer to pipeline
const UINT stride = sizeof( Vertex ); const UINT stride = sizeof( Vertex );
const UINT offset = 0u; const UINT offset = 0u;
pContext->IASetVertexBuffers( 0u,1u,&pVertexBuffer,&stride,&offset ); pContext->IASetVertexBuffers( 0u,1u,pVertexBuffer.GetAddressOf(),&stride,&offset );
// create vertex shader // create vertex shader
...@@ -153,6 +153,21 @@ void Graphics::DrawTestTriangle() ...@@ -153,6 +153,21 @@ void Graphics::DrawTestTriangle()
pContext->PSSetShader( pPixelShader.Get(),nullptr,0u ); pContext->PSSetShader( pPixelShader.Get(),nullptr,0u );
// bind render target
pContext->OMSetRenderTargets( 1u,pTarget.GetAddressOf(),nullptr );
// configure viewport
D3D11_VIEWPORT vp;
vp.Width = 800;
vp.Height = 600;
vp.MinDepth = 0;
vp.MaxDepth = 1;
vp.TopLeftX = 0;
vp.TopLeftY = 0;
pContext->RSSetViewports( 1u,&vp );
GFX_THROW_INFO_ONLY( pContext->Draw( (UINT)std::size( vertices ),0u ) ); GFX_THROW_INFO_ONLY( pContext->Draw( (UINT)std::size( vertices ),0u ) );
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment