Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Release LPDIRECT3DTEXTURE9*

4: Adsense

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   

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.

#2 Hodgman   Moderators   

50638
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   

276
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   

276
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   

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.