OSG论坛管理员 发表于 2009-6-6 00:52:35

GLSL教程(9) 资源释放

GLSL教程译:FreeSouth
资源释放
在上节,我们尝试了如何绑定shader到program中,也同样有解除绑定这样的功能。
OpenGL2.0语法如下:
________________________________________
void glDetachShader(GLuint program, GLuint shader);
参数:
program - The program to detach from.
shader - The shader to detach.
________________________________________
ARB扩展:
________________________________________
void glDetachObjectARB(GLhandleARB program, GLhandleARB shader);
参数:
program - The program to detach from.
shader - The shader to detach.
________________________________________
上述函数只能解除shader的绑定关系,有些shader可能未被绑定,下面的函数用来释放shader与program.
________________________________________
void glDeleteShader(GLuint id);
void glDeleteProgram(GLuint id);
参数:
id - The handler of the shader or program to delete.
________________________________________
使用ARB扩展:
________________________________________
void glDeleteObjectARB(GLhandleARB id);
参数:
id - The handler of the shader or program to delete.
________________________________________
万一一个shader仍旧和一个或多个program绑定,那么这个shader不会被立即删除,仅仅是标记,当它没有与任何program绑定时,将被删除。

原文:http://www.lighthouse3d.com/opengl/glsl/index.php?oglcleanup


xiang_521 发表于 2013-11-20 18:01:12

不错,不错,楼主辛苦啦

tuncaysanli 发表于 2014-1-17 16:44:45

好东西,搜藏了

flylong0204 发表于 2014-11-26 22:00:34

收藏了,赞一个
页: [1]
查看完整版本: GLSL教程(9) 资源释放