Jump to content
  • Advertisement
Sign in to follow this  
MefistoManna

Release LPDIRECT3DTEXTURE9*

This topic is 2304 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 loaded a mesh .x whit texture in direct3d. Now, how can i do to release LPDIRECT3DTEXTURE9* because if I call the function Release() i getted this error: error C2227: left of '->Release' must point to class/struct/union/generic type.
Thanks and sorry for my bad English.

Share this post


Link to post
Share on other sites
Advertisement
[font=courier new,courier,monospace]LPDIRECT3DTEXTURE9 is IDirect3DTexture9*[/font]
so
[font=courier new,courier,monospace]LPDIRECT3DTEXTURE9* is IDirect3DTexture9**[/font]

[font=courier new,courier,monospace]IDirect3DTexture9** tex; tex->Release();//error C2227[/font]
[font=courier new,courier,monospace]IDirect3DTexture9* tex; tex->Release();[/font]

Share this post


Link to post
Share on other sites
[color=#282828]IDirect3DTexture9 * will simply hold a single texture, since you are using x files; [color=#282828][background=rgb(250, 251, 252)]IDirect3DTexture9 ** will hold array of textures. You have to loop through that array of texture and then free that textures; here's how it's done:[/background]
[color=#282828][background=rgb(250, 251, 252)]
for(DWORD dwTextureCount = 0; [/background][color=#282828]dwTextureCount [color=#282828][background=rgb(250, 251, 252)]< m_dwNumOfMeshMaterials; dwSubCount++)
{[/background]
[color=#282828][background=rgb(250, 251, 252)]// Free the corresponding memory of the scene mesh textures[/background]
[color=#282828][background=rgb(250, 251, 252)]if([/background][color=#282828][background=rgb(250, 251, 252)]m_ppD3DSceneMeshTexture[[/background][color=#282828]dwTextureCount[color=#282828][background=rgb(250, 251, 252)]])[/background]
[color=#282828][background=rgb(250, 251, 252)]{[/background]
[color=#282828][background=rgb(250, 251, 252)]m_ppD3DSceneMeshTexture[[/background][color=#282828]dwTextureCount[color=#282828][background=rgb(250, 251, 252)]]->Release();[/background]
[color=#282828][background=rgb(250, 251, 252)]m_ppD3DSceneMeshTexture[[/background][color=#282828]dwTextureCount[color=#282828][background=rgb(250, 251, 252)]] = NULL;[/background]
[color=#282828][background=rgb(250, 251, 252)]}[/background]
[color=#282828][background=rgb(250, 251, 252)]}
[/background]

[color=#282828][background=rgb(250, 251, 252)]m_dwNumOfMeshMaterials: Number of materials of that corresponding mesh[/background]

Share this post


Link to post
Share on other sites
err...posting it again...

for(DWORD dwTextureCount = 0; dwTextureCount < m_dwNumOfMeshMaterials; dwSubCount++)
{
if(m_ppD3DSceneMeshTexture[dwTextureCount])
{
// Free the corresponding memory of the scene mesh textures
m_ppD3DSceneMeshTexture[dwTextureCount]->Release();
m_ppD3DSceneMeshTexture[dwTextureCount] = NULL;
}
}

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!