Proper way to delete GLSL shader?

前端 未结 4 1489
失恋的感觉
失恋的感觉 2020-12-04 11:21

My code approaches GLSL shader management in the way, that it creates each shader and the associated program and deletes each shader and program. I recently read http://www.

4条回答
  •  悲哀的现实
    2020-12-04 12:14

    In short: after glLinkProgram() call glDeleteShader() for each shader, this marks them for deletion and when the program is no longer needed call glDeleteProgram() - this call not only deletes the program but also detaches all shaders attached to it and deletes them (if not used by any other program).

    So normally you don't have to ever call glDetachShader(). Read the docs for glDeleteProgram().

提交回复
热议问题