SOIL image library and freeing memory
Question
I'm trying to write a class using soil to encapsulate SOIL calls. I can't however find any other means of deleting the memory if I load the image using
SOIL_load_OGL_texture
So what's the correct way to clean up after this call?
Solution
It returns OGL texture identifier
/* load an image file directly as a new OpenGL texture */
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
);
so it should be freed using OGL functions:
glDeleteTextures( 1, &tex_2d );
I have not used this lib, but this is what I would do
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow