Jump to content
  • Advertisement
Sign in to follow this  
thedo

c# ConvertToIndexedBlendedMesh disposes my mesh textures

This topic is 4507 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 have copied some code from the SimpleAnimation sample in the April 2006 SDK into my own app (which doesnt use the framework), but when I call ConvertToIndexedBlendedMesh the texture loaded for the mesh is disposed. I know this as I created an event for the texture dispose and it happens internal to the ConvertToIndexedBlendedMesh call. My code is in escence identical to the sdk example with the main difference being how i load the texture (the sample has some ResourceCache class, whereas I was simply using the TextureLoader. Has anyone else had this? If it was in C++ I'd probably AddRef it 1st, but this is in .net and I cant seem to find a way to sto pthis object from being disposed :( Any help would be awesome. Cheese Neil

Share this post


Link to post
Share on other sites
Advertisement
I don't see that behavior. I guess you should be sure to have a reference to that texture elsewhere before you call CTIBM. I'm not on April 2006 though; if they borked it, it'd be news to me too.

Share this post


Link to post
Share on other sites
Ive checked - ad prior to that call the object is valid. When i F10 over it, the Disposed event is fired and then it steps out of that ConvertMesh call.

The bizarre thing is that the array that holds the textures (meshTextures as in the SimpleAnimation sample) is still there, just now pointing at a disposed texture.

I am using VS2005, but the 2005 version of the SimpleAnimation works fine, so I'm guessing its not a .net2 issue.

Out of interest how do you load the Textures in your code - do you use the ResourceCache, or just the basic TextureLoader? As this is the only bit I modded from the sample, I'm guessing that that **may** have something to do with it?........

Cheese

Neil

Share this post


Link to post
Share on other sites
Try turning off the AutoEvents on the device. I've seen a couple of instances in the past where some Mesh functions caused odd things to dispose. I reported them as bugs with full repros but I don't think they ever got fixed. Turning off autoevents was a workaround that worked for me.

Share this post


Link to post
Share on other sites
Quote:
Original post by thedo
I am using VS2005, but the 2005 version of the SimpleAnimation works fine, so I'm guessing its not a .net2 issue.

Out of interest how do you load the Textures in your code - do you use the ResourceCache, or just the basic TextureLoader? As this is the only bit I modded from the sample, I'm guessing that that **may** have something to do with it?........


Just the basic Texture loader methods. And we're running .NET 2.0, but only 1.1 of MDX.

Share this post


Link to post
Share on other sites
Quote:
Just the basic Texture loader methods. And we're running .NET 2.0, but only 1.1 of MDX.


Yeah, you have the same config as me then.

In a fit of creative thinking, i solved the problem by loading the textures AFTER the Convert call. I think i couldnt see the wood for the trees there!

Cheers all.

N

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!