Advertisement Jump to content
Sign in to follow this  

DX11 StretchRect() in DX11?

This topic is 1658 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Guys,

Previously when I used DX9c I used to draw to a surface of a preset size (usually screen dimensions 1600x900) and when I went into windowed mode I would simply draw the surface to the window using...

(FAILED(d3dDevice->StretchRect(surfaceApplication,NULL,surfaceBackbuffer,&DstRect,D3DTEXF_LINEAR )))

So, this way the scene would resize gracefully and I could still move objects as if they were still in full screen dimensions.

Is there a way to do similar in DirectX 11?

Thanks in advance smile.png

Share this post

Link to post
Share on other sites
Thanks for the reply unbird smile.png

Makes sense what you are saying.

The camera system suggestion is an awesome one, I didn't even think of adjusting that.

I allready have an OrthoGraphic camera setup in my project, I tried adjusting the camera's window width and height, and what do you know 'it just works!'.

I was ready to have a hell of a time to get this working and it was easy in the end. So, it just goes to show some decent advance planning does pay off sometimes ;)

This will allow for all sorts of awesome zoom effects also! You have made my day smile.png Edited by DarkRonin

Share this post

Link to post
Share on other sites
Indeed. A flexible 2D camera is not only a good exercise in transformations, but since it results in changing only one matrix (usually) for the shader - which you do need anyway - it is practically free on the GPU side. Drop those magic numbers!

Glad you got it already biggrin.png Edited by unbird

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!