From bcc57bc649e13ff86262dd20247c801a8973151f Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 12 Dec 2021 15:14:57 +0000 Subject: glm::value_ptr is neater --- gfx/gl/shader.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gfx') 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 #include #include +#include #include #include #include @@ -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)); } } -- cgit v1.2.3