Rikkles
Rikkles

Reputation: 3372

DirectX12 rendering to part of the window

I am trying to have the DirectX12 pipeline render to only part of the window, not the full window. Is that even possible? I can manually translate the vertices, or set the screenViewport to be a smaller size, but the renderer still renders to the whole window, setting a background color to that which is unrendered.

Even if I set the backbuffers size to be the smaller size, the target view is still the whole window. How can I change the target view to be just a part of the window?

I must be missing something about CreateRenderTargetView()

Upvotes: 0

Views: 604

Answers (2)

user8616480
user8616480

Reputation:

Yes you can do it, just configure scissor-rect and viewport-rect for the region you are interested in.

Upvotes: 0

mateeeeeee
mateeeeeee

Reputation: 1002

You can pass D3D12_RECT to ClearRenderTargetView to specify what portion of a render target to clear. So set your viewport of smaller size, clear only that part and you should be good to go.

Upvotes: 1

Related Questions