Sign in to follow this  

Changing render window size at Runtime

This topic is 3739 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

I used to think it's impossible to change the render window size for a big game at run time. Because you know the device will reset once you change the render window size, that means every content need to be reload. Until I saw what World Of Warcraft has done: When the game is running on window mode, it can be scale anytime you want. That's what I'm trying, I know it must be first draw on the map in a constant resolution, then drag the rendered map to fit the client size and here is the problem: Now I'm using Managed DirectX, I found once the client size changed, it'll immediately call the device.Reset(). So how to stop this ? I think it's not good to put this logic in my OnDeviceReset() function, is there any better way to make this ?

Share this post


Link to post
Share on other sites
The content doesn't have to be reloaded, it just has to be sent to the graphics card again from memory. This is considerably faster than reloading the content from disk to memory.

Share this post


Link to post
Share on other sites
Then you can look into D3DPOOL_MANAGED, which may keep your data in video card memory even when a reset occurs.

As for the reset issue, the device becomes automatically lost when the client size changes or focus is lost, and there is nothing you can do to prevent this.

The device is not usable anymore until it's reset, which is why automatic reset is actually useful.

Share this post


Link to post
Share on other sites
If you mean the user dragging the corner of the window when running in windowed mode, then you can create a 1x1 backbuffer when you create your device, and then create a seperate swap chain.

That allows you to destroy and recreate the swap chain without having to reset the device (and reload everything to VRAM). You'll still have to reset the device when going from windowed to fullscreen or vice-versa though.

And you should be using the managed pool for all non-dynamic resources anyway, so use it if you're not.

Share this post


Link to post
Share on other sites
I have specified the size of back buffer but it was still calling device.Reset(). The managed D3Ddevice is so automatically that the Device.OnParentResize() seems have delegated to the Control.OnResize() function, then the Device.OnParentResize() called Device.Reset().
And finally I found this Event in the Managed D3Ddevice

device.DeviceResizing += new System.CancelEventHandler(this.DeviceResizingEventHandler);


That mean I must cancel this event handler manually. I hate automatic T_T
Thx Every one

Share this post


Link to post
Share on other sites

This topic is 3739 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this