Jump to content
  • Advertisement
Sign in to follow this  
ThetaRabbit

OpenGL Texture unloading

This topic is 2386 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 all. I use SOIL with OpenGL. This is a sample from of code lonesock.net/soil.html :



GLuint tex_2d = SOIL_load_OGL_texture
(
"img.png",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_MIPMAPS | SOIL_FLAG_INVERT_Y | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT
);



How can I unload my texture from memory after using this code?

[size=2]sorry for my bad english.

Share this post


Link to post
Share on other sites
Advertisement
Depends on which memory you want to unload it from. If you want to unload it from video memory then glDeleteTextures is indeed what you want - the texture will be gone (eventually - glDeleteTextures most likely won't remove it immediately and doesn't actually make any promises about the backing memory store (which may e.g. be kept around for potential future reuse) - all it deals with is the texture object name) and you will never be able to use it again in your OpenGL code unless you recreate it.

Share this post


Link to post
Share on other sites
looking at the SOIL source, i believe your looking for:


SOIL_free_image_data


look at the header for more information, and i don't claim to be 100% correct, i've never used soil, but i don't see anything else that seems to indicate deleting behavior.

Share this post


Link to post
Share on other sites

looking at the SOIL source, i believe your looking for:


SOIL_free_image_data


look at the header for more information, and i don't claim to be 100% correct, i've never used soil, but i don't see anything else that seems to indicate deleting behavior.


I think that's only if you've loaded the file with

SOIL_load_image, because it returns an unsigned char buffer *, not an OpenGL asset ID.

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!