]> git.sesse.net Git - movit/blobdiff - effect.cpp
Make a new system for meta-effects, and convert the blur to use it. Hides the two...
[movit] / effect.cpp
index edf100c566c549417f7df158472a6803c3e2da87..8cba87bc7b388a6761b81acc8939a6df5cef397a 100644 (file)
@@ -33,6 +33,18 @@ void set_uniform_float(GLuint glsl_program_num, const std::string &prefix, const
        check_error();
 }
 
+void set_uniform_float_array(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const float *values, size_t num_values)
+{
+       std::string name = prefix + "_" + key;
+       GLint l = glGetUniformLocation(glsl_program_num, name.c_str());
+       if (l == -1) {
+               return;
+       }
+       check_error();
+       glUniform1fv(l, num_values, values);
+       check_error();
+}
+
 void set_uniform_vec2(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const float *values)
 {
        std::string name = prefix + "_" + key;
@@ -57,6 +69,18 @@ void set_uniform_vec3(GLuint glsl_program_num, const std::string &prefix, const
        check_error();
 }
 
+void set_uniform_vec4_array(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const float *values, size_t num_values)
+{
+       std::string name = prefix + "_" + key;
+       GLint l = glGetUniformLocation(glsl_program_num, name.c_str());
+       if (l == -1) {
+               return;
+       }
+       check_error();
+       glUniform4fv(l, num_values, values);
+       check_error();
+}
+
 bool Effect::set_int(const std::string &key, int value)
 {
        if (params_int.count(key) == 0) {