Jump to content

  • Log In with Google      Sign In   
  • Create Account

Why resizing window causes OnCreateDevice() to be invoked?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Jeason   Members   -  Reputation: 96

Like
0Likes
Like

Posted 24 February 2012 - 03:14 AM

I'm very confused. Why?
I have built my project like the sample in DXSDK.

I find it does invoke OnCreateDevice() when I trace the path of the program.
Have you met it ?

Sponsor:

#2 Jeason   Members   -  Reputation: 96

Like
0Likes
Like

Posted 24 February 2012 - 04:11 AM

I solve it!

I move a CloneMesh() function which is in OnCreateDevice() originally to OnResetDevice(), and release it in OnLostDevice().

Is that because not all memory in POOL_DEFAULT are released, then DXUT will return to call OnDestroyDevice() and OnCreateDevice()?

#3 programci_84   Members   -  Reputation: 336

Like
1Likes
Like

Posted 24 February 2012 - 04:47 AM

Basically, if you change some properties defined in D3DPRESENT_PARAMETERS object (like auto depth buffer usage, window dimensions etc.), it's recommended to reset your device. You don't have to do that for resizing, but, for example, if you resize the window in windowed mode and if you don't reset the device, rendered image may be distorted each time you resized the window. If you want to change device properties (e.g. Vertex Processing: like switching from H/W to Pure HW, Device Type: like switching HAL to REF), you must release your device then recreate.

Before you reset or release the device, you must release all the memory but in D3DPOOL_MANAGED (e.g. D3DXLoadMeshFromX function creates meshes in D3DPOOL_MANAGED). After resetting or recreating, you must recreate corresponding memory.

hth.
-R
There's no "hard", and "the impossible" takes just a little time.

#4 kubera   Members   -  Reputation: 973

Like
1Likes
Like

Posted 24 February 2012 - 08:25 AM

Hi!

Maybe you would read this thread:
http://forums.create...ms/t/71798.aspx

Another reason for recreating the device would be an unreleased interface from previous device state.
(simply something was not released on LostDevice callback and D3D forces recreation because of the invalid state)

#5 Jeason   Members   -  Reputation: 96

Like
0Likes
Like

Posted 27 February 2012 - 02:06 AM

Thank you, programci_84 and kubera.Posted Image

I think the circumstance presented by kubrea is same to mine.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS