aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-08-11 20:33:35 +0200
committervaxerski <[email protected]>2022-08-11 20:33:35 +0200
commit37442db20ee9ad03960d5bf337efb5716cc28985 (patch)
treeca222bf606f704c72e0e9e6fdef5f0fe093cd61d
parentb178891ab352d3306833fc0f48e5ea395e946300 (diff)
downloadHyprland-37442db20ee9ad03960d5bf337efb5716cc28985.tar.gz
Hyprland-37442db20ee9ad03960d5bf337efb5716cc28985.zip
destroy program in shader destructor
-rw-r--r--src/render/Shader.cpp7
-rw-r--r--src/render/Shader.hpp4
2 files changed, 10 insertions, 1 deletions
diff --git a/src/render/Shader.cpp b/src/render/Shader.cpp
index 96b3caf7..d3f2afb2 100644
--- a/src/render/Shader.cpp
+++ b/src/render/Shader.cpp
@@ -10,4 +10,11 @@ GLint CShader::getUniformLocation(const std::string& unif) {
}
return itpos->second;
+}
+
+CShader::~CShader() {
+ // destroy shader
+ if (program != 0) {
+ glDeleteProgram(program);
+ }
} \ No newline at end of file
diff --git a/src/render/Shader.hpp b/src/render/Shader.hpp
index 3d3b3ddb..fc06d68b 100644
--- a/src/render/Shader.hpp
+++ b/src/render/Shader.hpp
@@ -5,7 +5,9 @@
class CShader {
public:
- GLuint program;
+ ~CShader();
+
+ GLuint program = 0;
GLint proj;
GLint color;
GLint tex;