=== modified file 'shader.cpp'
@@ -27,7 +27,7 @@
Shader::~Shader()
{
- remove();
+ unload();
}
void Shader::load(const char *pVertexShaderFileName, const char *pFragmentShaderFileName)
@@ -122,8 +122,19 @@
void Shader::remove()
{
+ glUseProgramObjectARB(0);
+}
+
+void Shader::unload()
+{
glDetachObjectARB(mShaderProgram, mVertexShader);
glDetachObjectARB(mShaderProgram, mFragmentShader);
-
+
+ glDeleteObjectARB(mVertexShader);
+ glDeleteObjectARB(mFragmentShader);
glDeleteObjectARB(mShaderProgram);
+
+ mVertexShader = 0;
+ mFragmentShader = 0;
+ mShaderProgram = 0;
}
=== modified file 'shader.h'
@@ -11,8 +11,10 @@
public:
~Shader();
void load(const char *pVertexShaderFileName, const char *pFragmentShaderFileName);
+ void unload();
+
+ void use();
void remove();
- void use();
GLuint mVertexShader;
GLuint mFragmentShader;