Jump to content
  • Advertisement
Sign in to follow this  
bartiss

D3DXCreateTextureFromFile() - how to remove it?

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

Hi, Can anybody tell me how to free memory used by a texture loaded from file using D3DXCreateTextureFromFile(...) ? I'm using it to load single, big textures, but need to render only one at a time (performance isn't important here). So I want to load new texture to the same LPDIRECT3DTEXTURE9, but now I get memory usage increase everytime I load the texture... I tried both delete and Release() on the LPDIRECT3DTEXTURE9 and I got exeptions :) How do you do it? Thanks Bartiss

Share this post


Link to post
Share on other sites
Advertisement
Make sure the texture is not still selected into the device and call Release.

If you still get the exceptions switch the DirectX runtime to debug and turn up the debug output to maximum. This should tell you why it can't release the texture.

Share this post


Link to post
Share on other sites
Ack, I didn't know D3D required this. Does anyone know how ID3DXSprite handles this? I track which textures are set in the device when rendering - so I can null those stages when they get released, but I don't set textures for the sprite calls. I wouldn't even know what stage it uses. I'm assuming the first stage only?

Anyone know how to handle that properly? Is it possible to query D3D for each stage's texture in pure device mode?

Sorry for hijacking the thread.

edit: Err, sorry. I looked up GetTexture. Not used to the docs being very useful.

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!