diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-12-12 15:14:57 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-12-12 15:14:57 +0000 |
commit | bcc57bc649e13ff86262dd20247c801a8973151f (patch) | |
tree | bbe82ab679d30d2e6a3447c3a448643ff76c724e | |
parent | Refactor wrapped_ptr to include destory function as template param, and possi... (diff) | |
download | ilt-bcc57bc649e13ff86262dd20247c801a8973151f.tar.bz2 ilt-bcc57bc649e13ff86262dd20247c801a8973151f.tar.xz ilt-bcc57bc649e13ff86262dd20247c801a8973151f.zip |
glm::value_ptr is neater
-rw-r--r-- | gfx/gl/shader.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gfx/gl/shader.cpp b/gfx/gl/shader.cpp index b8210d1..771db97 100644 --- a/gfx/gl/shader.cpp +++ b/gfx/gl/shader.cpp @@ -9,6 +9,7 @@ #include <gfx/gl/shaders/vs-landmassShader.h>
#include <gfx/gl/shaders/vs-waterShader.h>
#include <glm/glm.hpp>
+#include <glm/gtc/type_ptr.hpp>
#include <glm/gtx/transform.hpp>
#include <location.hpp>
#include <maths.h>
@@ -59,7 +60,7 @@ Shader::setView(glm::mat4 proj) const {
for (const auto & prog : programs) {
glUseProgram(prog.m_program);
- glUniformMatrix4fv(prog.viewProjection_uniform, 1, GL_FALSE, &proj[0][0]);
+ glUniformMatrix4fv(prog.viewProjection_uniform, 1, GL_FALSE, glm::value_ptr(proj));
}
}
@@ -69,7 +70,7 @@ Shader::setUniform(const GLchar * uniform, glm::vec3 v) const for (const auto & prog : programs) {
if (auto loc = glGetUniformLocation(prog.m_program, uniform); loc >= 0) {
glUseProgram(prog.m_program);
- glUniform3fv(loc, 1, &v[0]);
+ glUniform3fv(loc, 1, glm::value_ptr(v));
}
}
}
@@ -81,7 +82,7 @@ Shader::setModel(const Location & loc, Program pid) const glUseProgram(prog.m_program);
if (prog.model_uniform >= 0) {
const auto model {glm::translate(loc.pos) * rotate_ypr(loc.rot)};
- glUniformMatrix4fv(prog.model_uniform, 1, GL_FALSE, &model[0][0]);
+ glUniformMatrix4fv(prog.model_uniform, 1, GL_FALSE, glm::value_ptr(model));
}
}
|