aboutsummaryrefslogtreecommitdiff
path: root/src/shader.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-05-14 16:44:28 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-14 16:44:28 +0200
commit23ba151d95e4284ddb2d5f1c9810741061c293fd (patch)
tree98d9aa1322dc108e1adf2a695fc642266e05c2b3 /src/shader.c
parent29ea8338efb0b5450611b73463c9d7d469db2d75 (diff)
downloadscop-23ba151d95e4284ddb2d5f1c9810741061c293fd.tar.gz
scop-23ba151d95e4284ddb2d5f1c9810741061c293fd.tar.bz2
scop-23ba151d95e4284ddb2d5f1c9810741061c293fd.zip
Refactoring to the point before started refactoring, without crash on texture binding
Diffstat (limited to 'src/shader.c')
-rw-r--r--src/shader.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/shader.c b/src/shader.c
index a325f16..fb659ad 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 14:02:56 by charles ### ########.fr */
+/* Updated: 2020/05/14 16:41:29 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -44,13 +44,16 @@ static unsigned int st_compile(char *filepath, unsigned int type)
return (id);
}
-static bool st_get_uniform_location(unsigned int shader_id, int *location, char *name)
+static bool st_get_uniform_location(
+ unsigned int shader_id,
+ int *location,
+ char *name)
{
GL_CALL(*location = glGetUniformLocation(shader_id, name));
return (*location != -1);
}
-bool shader_init(t_shader *shader)
+bool shader_init(t_shader *shader)
{
unsigned int shader_vertex;
unsigned int shader_fragment;
@@ -68,13 +71,15 @@ bool shader_init(t_shader *shader)
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.texture, "u_texture")) */
return (false);
return (true);
}
-void shader_update_mvp(t_shader *shader, t_scene *scene)
+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(glUniformMatrix4fv(shader->location.texture, 1, GL_TRUE, scene->transform.proj.m)); */
}