Archived

This topic is now archived and is closed to further replies.

resizing a directx window

This topic is 5649 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 i am currently building a little directx program in a windowed environment but i notice that whenever i resize the window, the rendered image stretches automatically with the window. i would prefer to get rid of this effect, i.e. whatever i draw i would like to draw in the exact same shape no matter how the window gets resized. i''ve tried a few things, i''ve tried setting projection matrices, i''ve tried setting the viewport. but in the end it seems that what sets the size of your rendering is the size of the back buffer. to chance the back buffer, the Reset() function of the Direct3DDevice class requires that you release almost everything, including textures. that''s a little too much. I think you should also be able to set a back buffer the size of the screen and just copy a rectangle the size of your window to the front buffer, but it seems that only a D3DSWAPEFFECT_COPY swap effect will work, but D3DSWAPEFFECT_COPY has too much overhead so i prefer to use D3DSWAPEFFECT_DISCARD. does anybody know how to overcome this problem? basically, change your rendering area''s size on the fly? thanx

Share this post


Link to post
Share on other sites
Check your present() function, the pDestRect parameter. If its null, it will use the entire area of the window. Pass it a fixed rect should do what you are looking for.

Also look under the windows sdk for WM_GETMINMAXINFO. If you support this message you can do things such as blocking resizing the window etc.

Share this post


Link to post
Share on other sites