Sign in to follow this  
auto.magician

Help with managed ID3DXMesh during screen mode change

Recommended Posts

auto.magician    128
Hi all,

The scenario...

I have a scene with a cube created with D3DXCreateBox. I have also made a quad to use as a plane, using 4 vertices and 2 triangles created with D3DXCreateMeshFVF using the D3DXMESH_MANAGED flag with the appropriate other parameters filled in as necessary. The cube and the plane show up OK while in the initial created mode, but as soon as I change modes( windowed/fullscreen) the program crashes when it comes to rendering the plane.

In my code (now test code) I have the same effect loaded ( uses the exact same code for loading the effect for both meshes ) for the cube and the plane although they are different instances now. Each mesh will only render if the Effect is not NULL ( again,.. testing code ). If I create the effect for the cube ONLY so the plane doesnt render with its instance of the effect, then the scene will survive correctly through the changing from window to fullscreen and back again. But when I include the plane in the scene, the program crashes with EAV which I take as telling me that something needs to managed during the change, even though I've created the plane using the D3DXMESH_MANAGED flag.
Could it be the way I'm creating the vertices and indices?? using the DISCARD flag or is there something I'm completely missing?

In my code I have a 'Mesh' class ( the cube and plane use this same class ) which contains a variable to the instance of the Effect that it uses, there are callback methods that get called during device reset phase to manage its appropriate resources. In these methods I call ID3DXEffect.OnLostDevice and ID3DXEffect.OnResetDevice correctly. Like I say the 'CUBE' survives with no problems, but the 'PLANE' is causing an issue. The only difference between the two ( including creation and rendering ) is the creation phase.
Any ideas/help is greatly appreciated.


Many thanks

Dave

Share this post


Link to post
Share on other sites

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