File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed
Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 11
2+ #include < algorithm>
23#include < string>
34#include < vector>
45#include < stdio.h>
@@ -61,6 +62,9 @@ GLuint CreateProgram(const std::vector<GLuint> &shaderList)
6162 delete[] strInfoLog;
6263 }
6364
65+ for (size_t iLoop = 0 ; iLoop < shaderList.size (); iLoop++)
66+ glDetachShader (program, shaderList[iLoop]);
67+
6468 return program;
6569}
6670
@@ -92,6 +96,8 @@ void InitializeProgram()
9296 shaderList.push_back (CreateShader (GL_FRAGMENT_SHADER, strFragmentShader));
9397
9498 theProgram = CreateProgram (shaderList);
99+
100+ std::for_each (shaderList.begin (), shaderList.end (), glDeleteShader);
95101}
96102
97103const float vertexPositions[] = {
Original file line number Diff line number Diff line change 11
2+ #include < algorithm>
23#include < string>
34#include < vector>
45#include < fstream>
@@ -49,6 +50,8 @@ namespace Framework
4950 fprintf (stderr, e.what ());
5051 throw ;
5152 }
53+
54+ std::for_each (shaderList.begin (), shaderList.end (), glDeleteShader);
5255 }
5356
5457 float DegToRad (float fAngDeg )
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ namespace Framework
1313 GLuint CreateShader (GLenum eShaderType,
1414 const std::string &strShaderFile, const std::string &strShaderName);
1515 GLuint LoadShader (GLenum eShaderType, const std::string &strShaderFilename);
16+
17+ // Will *delete* the shaders given.
1618 GLuint CreateProgram (const std::vector<GLuint> &shaderList);
1719
1820 // Will find a file with the given base filename, either in the local directory or the global one.
You can’t perform that action at this time.
0 commit comments