Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
hw3d
Commits
85bff2d8
Commit
85bff2d8
authored
Jan 29, 2019
by
chili
Browse files
set render target and viewport
parent
50b40da5
Changes
1
Show whitespace changes
Inline
Side-by-side
hw3d/Graphics.cpp
View file @
85bff2d8
...
...
@@ -131,7 +131,7 @@ void Graphics::DrawTestTriangle()
// Bind vertex buffer to pipeline
const
UINT
stride
=
sizeof
(
Vertex
);
const
UINT
offset
=
0u
;
pContext
->
IASetVertexBuffers
(
0u
,
1u
,
&
pVertexBuffer
,
&
stride
,
&
offset
);
pContext
->
IASetVertexBuffers
(
0u
,
1u
,
pVertexBuffer
.
GetAddressOf
()
,
&
stride
,
&
offset
);
// create vertex shader
...
...
@@ -153,6 +153,21 @@ void Graphics::DrawTestTriangle()
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
)
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment