Hi there, I am rendering my game to render textures but I am having difficulty figuring out how to scale it to fill the window. The window looks like this:
and the render texture looks like this (it's the window resolution downscaled by 4):
(I implemented a screenshot function of the render texture which has proved to be very useful getting this working so far).
My vertex shader is the classic "draw fullscreen triangle without binding a vertex or index buffer" as seen many times on this site:
PS_IN_PosTex main(uint id : SV_VertexID)
{
PS_IN_PosTex output;
output.tex = float2((id << 1) & 2, id & 2);
output.pos = float4(output.tex * float2(2, -2) + float2(-1, 1), 0, 1);
return output;
}
and the pixel shader is simply:
Texture2D txDiffuse : register(t0);
SamplerState samp : register(s0);
float4 main(PS_IN_PosTex input) : SV_TARGET
{
return txDiffuse.Sample(samp, input.tex);
}
Can someone please give me a clue as to how to scale this correctly?
Many thanks,
Andy