]> git.sesse.net Git - movit/blobdiff - effect.cpp
Add a white balance effect (port of my white balance effect from Frei0r).
[movit] / effect.cpp
index d0222dec91f936e662d5c82adb1c05ccf0eb4110..74bd939f3f1e811303519e4aaf5d5ed2dac615bb 100644 (file)
@@ -79,6 +79,24 @@ void set_uniform_vec4_array(GLuint glsl_program_num, const std::string &prefix,
        check_error();
 }
 
+void set_uniform_mat3(GLuint glsl_program_num, const std::string &prefix, const std::string &key, const Matrix3x3 matrix)
+{
+       GLint location = get_uniform_location(glsl_program_num, prefix, key);
+       if (location == -1) {
+               return;
+       }
+       check_error();
+
+       // Convert to float (GLSL has no double matrices).
+       float matrixf[9];
+       for (unsigned i = 0; i < 9; ++i) {
+               matrixf[i] = matrix[i];
+       }
+
+       glUniformMatrix3fv(location, 1, GL_FALSE, matrixf);
+       check_error();
+}
+
 bool Effect::set_int(const std::string &key, int value)
 {
        if (params_int.count(key) == 0) {