summaryrefslogtreecommitdiffhomepage
path: root/src/shader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader.cpp')
-rw-r--r--src/shader.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/shader.cpp b/src/shader.cpp
index 08da2a8..7542337 100644
--- a/src/shader.cpp
+++ b/src/shader.cpp
@@ -7,6 +7,10 @@
#include "glad/glad.h"
+#include <glm/glm.hpp>
+#include <glm/gtc/matrix_transform.hpp>
+#include <glm/gtc/type_ptr.hpp>
+
Shader::Shader(const char* vertexPath, const char* fragmentPath)
{
// 1. retrieve the vertex/fragment source code from filePath
@@ -108,3 +112,13 @@ void Shader::set4f(const std::string &name, float value0, float value1, float va
{
glUniform4f(glGetUniformLocation(ID, name.c_str()), value0, value1, value2, value3);
}
+
+void Shader::setMatrix4fv(const std::string &name, glm::mat4 matrix)
+{
+ glUniformMatrix4fv(
+ glGetUniformLocation(ID, name.c_str()),
+ 1,
+ GL_FALSE,
+ glm::value_ptr(matrix)
+ );
+}