How can I change the resolution and stretch my entire game to the new resolution? I want my game to have a base resolution, and when I change it to stretch to that new resolution. I saw a few similar questions but all the answers suggested that i should change the presentation parameters. If i do that, my screen resolution changes, but all my other objects remain the same size and draw in the wrong position.

I use a LPD3DXSPRITE object to draw the textures to the screen, some DirectX text, and vertices defined as this:


I tried to put D3DXSPRITE_OBJECTSPACE at sprite->Begin() and play with the projection, view and world matrices but without success.

Can someone tell me if this method is possible and how should I do it? I also read about another method that suggested rendering to a surface, and then stretching the surface, but i don't know how to implement that. I am a beginner in DirectX. I googled the second method, but I couldn't find someone explaining it, and I don't think I can draw from a sprite to a surface.


1 Answer 1


You can use the direcx 9 function SetRenderTarget (http://msdn.microsoft.com/en-us/library/windows/desktop/bb174455(v=vs.85).aspx) to specify any number of renderable targets you want. This would typically be set to a buffer, and that buffer would be swapped with the front buffer to produce what is known as double buffered rendering.

What you are wanting to do is render the game at a different resolution though, despite the resolution of the window you are in, correct? For this, you could adjust the size of your viewport, which adjusts the resolution that is rendered to your render target. This is independent of the window resolution, but could yield unsavory results if the correct aspect ratio is not maintained.

Viewport Info http://msdn.microsoft.com/en-us/library/windows/desktop/bb206341(v=vs.85).aspx

  • \$\begingroup\$ Thanks a lot. I managed to do it with the SetRenderTarget method and StretchRect method. I didn't use viewports but i think i am going to use them later in the game. \$\endgroup\$
    – balauru
    Commented Mar 20, 2013 at 16:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .