1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #include "destroy_shader_program.h"
- #include "report_gl_error.h"
- #include <cstdio>
- IGL_INLINE bool igl::opengl::destroy_shader_program(const GLuint id)
- {
-
- if(id == 0)
- {
- fprintf(stderr,"Error: destroy_shader_program() id = %d"
- " but must should be positive\n",id);
- return false;
- }
-
- GLsizei count;
-
- GLuint s;
- do
- {
-
- glGetAttachedShaders(id,1,&count,&s);
- GLenum err = igl::opengl::report_gl_error();
- if (GL_NO_ERROR != err)
- {
- return false;
- }
-
- if(count == 1)
- {
-
- glDetachShader(id,s);
- glDeleteShader(s);
- }
- }while(count > 0);
-
- glDeleteProgram(id);
- return true;
- }
- #ifdef IGL_STATIC_LIBRARY
- #endif
|