|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
ent_setmesh and LPD3DXMEHS
#209749
06/05/08 13:01
06/05/08 13:01
|
Joined: Jan 2003
Posts: 4,615 Cambridge
Joey
OP
Expert
|
OP
Expert
Joined: Jan 2003
Posts: 4,615
Cambridge
|
hello jcl,
i've got a question: i want to use the sdk to create a dll which replaces a mesh of a given entity. the dll is to be used with a7. the mesh is created with D3DXCreateMeshFVF, the flags are set to D3DXMESH_MANAGED | D3DXMESH_32BIT and the vertex format is the one described in the manual (D3DFVF_TLSHADED). the mesh is then set to the entity via ent_setmesh(entity, mesh, 0, 0). this process works properly.
now, when i delete the mesh, i call mesh->Release() and ent_setmesh(entity, NULL, 0, 0). now, when i have multiple entities sharing the same mesh, i have to call that only for the last entity, obviously. but now, for the last entity, the dll crashes. i took out mesh->Release() and it didn't crash - one time. the next time i tried it crashed again. it also crashed when i just closed the engine window, even though i'm calling Release() for all meshes i created in DLL_PROCESS_DETACH. here again, it worked once by taking out ent_setmesh, crashed again, i took out the Release-stuff and it worked one time but then crashed.
could it be that the error comes from the mesh format, a different dx sdk version (i'm using april 08), or... well, i'm somehow stuck here because sometimes the crash happens in the engine (ent_setmesh) and sometimes in the dll (Release).
i'd be very grateful for any hint you might have.
|
|
|
Re: ent_setmesh and LPD3DXMEHS
[Re: jcl]
#209773
06/05/08 17:05
06/05/08 17:05
|
Joined: Jan 2003
Posts: 4,615 Cambridge
Joey
OP
Expert
|
OP
Expert
Joined: Jan 2003
Posts: 4,615
Cambridge
|
i've installed the old sdk which made the whole stuff work one time but then crashed again when removing the mesh.
but now i could track down the error, the crashes weren't that random anymore. if i call mesh->Release() after ent_setmesh(entity, NULL, 0, 0) the thing crashes. i tend to think that ent_setmesh already released the mesh. how i can know that? well, if i release the mesh before calling ent_setmesh the latter one crashes, so at least it tries to do something with the old mesh.
i'm not sure, but since the crashes don't occur any more... but i don't want to bloat my memory consumption, neither!
thanks for the hint with the sdk, it helped a lot! the D3DXMESH_32BIT changed nothing, though, and anyway, how are you supposed to create meshes with more than 2^16 vertices without 32 bit indices?
joey.
|
|
|
|