detach and delete shaders directly after linking
This commit is contained in:
parent
f05bc50d40
commit
f1e0816c1a
|
@ -87,6 +87,12 @@ bool LinkShaderProgram(GLuint* ids)
|
||||||
|
|
||||||
glLinkProgram(ids[2]);
|
glLinkProgram(ids[2]);
|
||||||
|
|
||||||
|
glDetachShader(ids[2], ids[0]);
|
||||||
|
glDetachShader(ids[2], ids[1]);
|
||||||
|
|
||||||
|
glDeleteShader(ids[0]);
|
||||||
|
glDeleteShader(ids[1]);
|
||||||
|
|
||||||
glGetProgramiv(ids[2], GL_LINK_STATUS, &res);
|
glGetProgramiv(ids[2], GL_LINK_STATUS, &res);
|
||||||
if (res != GL_TRUE)
|
if (res != GL_TRUE)
|
||||||
{
|
{
|
||||||
|
@ -97,8 +103,6 @@ bool LinkShaderProgram(GLuint* ids)
|
||||||
printf("OpenGL: failed to link shader program: %s\n", log);
|
printf("OpenGL: failed to link shader program: %s\n", log);
|
||||||
delete[] log;
|
delete[] log;
|
||||||
|
|
||||||
glDeleteShader(ids[0]);
|
|
||||||
glDeleteShader(ids[1]);
|
|
||||||
glDeleteProgram(ids[2]);
|
glDeleteProgram(ids[2]);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -109,8 +113,6 @@ bool LinkShaderProgram(GLuint* ids)
|
||||||
|
|
||||||
void DeleteShaderProgram(GLuint* ids)
|
void DeleteShaderProgram(GLuint* ids)
|
||||||
{
|
{
|
||||||
glDeleteShader(ids[0]);
|
|
||||||
glDeleteShader(ids[1]);
|
|
||||||
glDeleteProgram(ids[2]);
|
glDeleteProgram(ids[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue