Jump to content
  • Advertisement
Sign in to follow this  
codingsolo

Failing to Release() IDirect3DTexture9 from .X file

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

My Resource Manager is calling a shutdown on my X files and it seems that even though it is calling Release() on the last texture, it isn't affecting it. The .X file has a total of 4 materials in it. The first 3 textures Release() perfectly fine, changing to 0xfeeefeee after the call, but the last one remains unchanged. I have profiled it in PIX to confirm that it isn't releasing. Any experience on what is going on?
while(xFiles.size())
    {
        XFile* sfds = xFiles.back();

        unsigned int count = xFiles.back()->nNumMats;
        for(unsigned int i=0; i<count; i++)
        {
            if (LPDIRECT3DTEXTURE9 temp = xFiles.back()->pMeshTextures)
            {
                temp->Release();
                temp = NULL;
            }
           
        }
        SAFE_DELETE_ARRAY(xFiles.back()->pMeshTextures);
        SAFE_DELETE_ARRAY(xFiles.back()->pMeshMaterials);
        SAFE_RELEASE(xFiles.back()->pMesh);
       
        SAFE_DELETE(xFiles.back());
        xFiles.pop_back();
    }


coding solo

Share this post


Link to post
Share on other sites
Advertisement
Your last call SetTexture() may result it.
SDK reference told that: when you chancel your applicon, you should call SetTexture(0), else, the reference to the texture resource will not be zero. so the texture would not be released in fact.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!