Proper way to delete GLSL shader?

前端 未结 4 1493
失恋的感觉
失恋的感觉 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:00

    In general, the way shader object management works is simple. Shader objects don't really do anything, so there's no point in tracking them at all. Shader objects should exist for just long enough to successfully link a program object. After which time, the shaders should be detached from the program and deleted.

    The above assumes that you aren't trying to use the shader object to link with a different program, of course. That's certainly possible. In that case, you should delete your shader objects after you have linked all of your programs.

提交回复
热议问题