summaryrefslogtreecommitdiff
path: root/gfx/gl
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-12-12 15:14:57 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-12-12 15:14:57 +0000
commitbcc57bc649e13ff86262dd20247c801a8973151f (patch)
treebbe82ab679d30d2e6a3447c3a448643ff76c724e /gfx/gl
parentRefactor wrapped_ptr to include destory function as template param, and possi... (diff)
downloadilt-bcc57bc649e13ff86262dd20247c801a8973151f.tar.bz2
ilt-bcc57bc649e13ff86262dd20247c801a8973151f.tar.xz
ilt-bcc57bc649e13ff86262dd20247c801a8973151f.zip
glm::value_ptr is neater
Diffstat (limited to 'gfx/gl')
-rw-r--r--gfx/gl/shader.cpp7
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));
}
}