Failing to Release() IDirect3DTexture9 from .X file

Started by
0 comments, last by Ham Ho 16 years, 11 months ago
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
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.

This topic is closed to new replies.

Advertisement