[英]SOIL image library and freeing memory
I'm trying to write a class using soil to encapsulate SOIL calls. 我正在尝试使用土壤来封装SOIL调用的类。 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? 那么,在通话后进行清理的正确方法是什么?
It returns OGL texture identifier 它返回OGL纹理标识符
/* 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: 因此应使用OGL函数将其释放:
glDeleteTextures( 1, &tex_2d );
I have not used this lib, but this is what I would do 我没有使用过这个库,但这是我会做的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.