Skip to content

Instantly share code, notes, and snippets.

@EddyLuten
Created April 21, 2014 07:01
Show Gist options
  • Save EddyLuten/11134505 to your computer and use it in GitHub Desktop.
Save EddyLuten/11134505 to your computer and use it in GitHub Desktop.
Chapter 2, Snippet 12 - OpenGLBook.com
void DestroyShaders(void)
{
GLenum ErrorCheckValue = glGetError();
glUseProgram(0);
glDetachShader(ProgramId, VertexShaderId);
glDetachShader(ProgramId, FragmentShaderId);
glDeleteShader(FragmentShaderId);
glDeleteShader(VertexShaderId);
glDeleteProgram(ProgramId);
ErrorCheckValue = glGetError();
if (ErrorCheckValue != GL_NO_ERROR)
{
fprintf(
stderr,
"ERROR: Could not destroy the shaders: %s \n",
gluErrorString(ErrorCheckValue)
);
exit(-1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment