aboutsummaryrefslogtreecommitdiff
path: root/src/shader.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-05-14 19:09:39 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-14 19:09:39 +0200
commitf6de2b1453930267015ab9323d5f83daa25667ba (patch)
tree5ff586948f7ffe257f8f46919f01bd99c1ffb82a /src/shader.c
parent23ba151d95e4284ddb2d5f1c9810741061c293fd (diff)
downloadscop-f6de2b1453930267015ab9323d5f83daa25667ba.tar.gz
scop-f6de2b1453930267015ab9323d5f83daa25667ba.tar.bz2
scop-f6de2b1453930267015ab9323d5f83daa25667ba.zip
Added ugly Cylindric UV mapping, texture/color transition
Diffstat (limited to 'src/shader.c')
-rw-r--r--src/shader.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/shader.c b/src/shader.c
index fb659ad..788cd47 100644
--- a/src/shader.c
+++ b/src/shader.c
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/05/11 09:35:54 by charles #+# #+# */
-/* Updated: 2020/05/14 16:41:29 by charles ### ########.fr */
+/* Updated: 2020/05/14 18:48:17 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -70,7 +70,8 @@ bool shader_init(t_shader *shader)
GL_CALL(glDeleteShader(shader_fragment));
if (!st_get_uniform_location(shader->id, &shader->location.model, "u_model")
|| !st_get_uniform_location(shader->id, &shader->location.view, "u_view")
- || !st_get_uniform_location(shader->id, &shader->location.proj, "u_proj"))
+ || !st_get_uniform_location(shader->id, &shader->location.proj, "u_proj")
+ || !st_get_uniform_location(shader->id, &shader->location.color_ratio, "u_color_ratio"))
/* || !st_get_uniform_location(shader->id, &shader->location.texture, "u_texture")) */
return (false);
return (true);
@@ -81,5 +82,6 @@ void shader_set_uniforms(t_shader *shader, t_scene *scene)
GL_CALL(glUniformMatrix4fv(shader->location.model, 1, GL_TRUE, scene->transform.model.m));
GL_CALL(glUniformMatrix4fv(shader->location.view, 1, GL_TRUE, scene->transform.view.m));
GL_CALL(glUniformMatrix4fv(shader->location.proj, 1, GL_TRUE, scene->transform.proj.m));
+ GL_CALL(glUniform1f(shader->location.color_ratio, scene->color_ratio));
/* GL_CALL(glUniformMatrix4fv(shader->location.texture, 1, GL_TRUE, scene->transform.proj.m)); */
}