Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Release LPDIRECT3DTEXTURE9*


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 MefistoManna   Members   -  Reputation: 139

Like
0Likes
Like

Posted 23 April 2012 - 06:58 AM

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.

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 30950

Like
0Likes
Like

Posted 23 April 2012 - 07:03 AM

LPDIRECT3DTEXTURE9 is IDirect3DTexture9*
so
LPDIRECT3DTEXTURE9* is IDirect3DTexture9**

IDirect3DTexture9** tex; tex->Release();//error C2227
IDirect3DTexture9* tex; tex->Release();

#3 Asesh   Members   -  Reputation: 268

Like
0Likes
Like

Posted 23 April 2012 - 08:03 PM

IDirect3DTexture9 * will simply hold a single texture, since you are using x files; 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:
for(DWORD dwTextureCount = 0; [/background][/color][color=#282828]dwTextureCount [/color][color=#282828][background=rgb(250, 251, 252)]< m_dwNumOfMeshMaterials; dwSubCount++)
{[/background][/color]
     [color=#282828][background=rgb(250, 251, 252)]// Free the corresponding memory of the scene mesh textures[/background][/color]
     [color=#282828][background=rgb(250, 251, 252)]if([/background][/color][color=#282828][background=rgb(250, 251, 252)]m_ppD3DSceneMeshTexture[[/background][/color][color=#282828]dwTextureCount[/color][color=#282828][background=rgb(250, 251, 252)]])[/background][/color]
     [color=#282828][background=rgb(250, 251, 252)]{[/background][/color]
  	    [color=#282828][background=rgb(250, 251, 252)]m_ppD3DSceneMeshTexture[[/background][/color][color=#282828]dwTextureCount[/color][color=#282828][background=rgb(250, 251, 252)]]->Release();[/background][/color]
	      [color=#282828][background=rgb(250, 251, 252)]m_ppD3DSceneMeshTexture[[/background][/color][color=#282828]dwTextureCount[/color][color=#282828][background=rgb(250, 251, 252)]] = NULL;[/background][/color]
     [color=#282828][background=rgb(250, 251, 252)]}[/background][/color]     
[color=#282828][background=rgb(250, 251, 252)]}


m_dwNumOfMeshMaterials: Number of materials of that corresponding mesh

#4 Asesh   Members   -  Reputation: 268

Like
1Likes
Like

Posted 23 April 2012 - 08:06 PM

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;
}
}

#5 MefistoManna   Members   -  Reputation: 139

Like
0Likes
Like

Posted 24 April 2012 - 05:55 AM

Thanks...now it works perfectly




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS