From afb9fb9d130b3e4b94da02e61ae9c9e0540edc3c Mon Sep 17 00:00:00 2001 From: klemek Date: Sun, 28 Sep 2025 23:36:50 +0200 Subject: [PATCH] wip state --- README.md | 7 ++++--- src/shaders.c | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d1662a9..10f48c6 100644 --- a/README.md +++ b/README.md @@ -125,11 +125,12 @@ make -f Makefile.dev release-arch - [x] random mode / demo mode with R/D key - [x] Clean code and fix things - [ ] Midi - - [ ] Read Midi events - - [ ] Read midi mapping config file + - [x] Read Midi events + - [x] Read midi mapping config file - [ ] Write Midi events + - [ ] Send midi data to shaders - [ ] Save midi state - - [ ] State machine with A/B switch + - [x] State machine with A/B switch - [ ] Tap-tempo feature - [ ] Clean code and fix things - [x] Video input diff --git a/src/shaders.c b/src/shaders.c index a58bb28..8c6289f 100644 --- a/src/shaders.c +++ b/src/shaders.c @@ -18,6 +18,8 @@ #include #include +static const GLuint unused_uniform = (GLuint)-1; + static void init_gl(ShaderProgram *program) { gladLoadGL(glfwGetProcAddress); @@ -433,25 +435,25 @@ static void update_viewport(ShaderProgram program, SharedContext *context) { } static void write_uniform_1f(GLuint location, float value) { - if (location != -1) { + if (location != unused_uniform) { glUniform1f(location, (const GLfloat)value); } } static void write_uniform_1i(GLuint location, unsigned int value) { - if (location != -1) { + if (location != unused_uniform) { glUniform1i(location, (const GLint)value); } } static void write_uniform_2f(GLuint location, vec2 *value) { - if (location != -1) { + if (location != unused_uniform) { glUniform2fv(location, 1, (const GLfloat *)value); } } // static void write_uniform_3f(GLuint location, vec3 *value) { -// if (location != -1) { +// if (location != unused_uniform) { // glUniform3fv(location, 1, (const GLfloat *)value); // } // }