Archived

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

tscott1213

Newbie DX9 Question

Recommended Posts

tscott1213    151
I am just shifting from DDraw to D3D and have, what I suspect to be, a pretty simple question. I am creating an app that will run in both windowed and full screen mode. In windowed mode the user should be able to resize the window. Therefore, I had originally thought to create BackBuffers that are the same size as the screen and then simply Present() the portion of the backbuffer that would be visible in the window. I created the backbuffers using the D3DSWAPEFFECT_DISCARD parameter. So, what is happening right now is when I call Present() D3D is "shrinking" the full screen backbuffer to fit in the windowed client instead of "clipping" it. So may questions are 1) How do I correct for this? and 2) Should I be creating backbuffers that are the size of the screen or simply resizing the backbuffer when the user changes the window size? Thanks Todd

Share this post


Link to post
Share on other sites
It''s a viable plan, just use the viewport to restrict where you render to in the back buffer and use the source rectangle argument to Present so that only that rectangle gets displayed.

You''ll have to use D3DSWAPEFFECT_COPY, at least when you''re in windowed mode. The source rectangle to Present isn''t available with _FLIP and _DISCARD.

Be aware that it''s quite possible -- if unusual -- for a window to have a client area that is larger than the display resolution. And on multimon systems you might end up with a whole lot more back buffer than you bargained for.

The big advantage to this approach is that window resizing is very fast, but at the expense of wasted video memory.

One alternative is to keep the back buffer sized to match the client area by resetting the device whenever you get a WM_SIZE.

Share this post


Link to post
Share on other sites