Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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:

#define D3DFVF_VERTEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)

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.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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

share|improve this answer
    
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. –  balauru Mar 20 '13 at 16:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.