X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=effect.cpp;fp=effect.cpp;h=74bd939f3f1e811303519e4aaf5d5ed2dac615bb;hp=d0222dec91f936e662d5c82adb1c05ccf0eb4110;hb=cfe0bc4fa1e2a56eeb12c33e596f79c1292292c8;hpb=24660d2111d0ee97228016a7072304ff657d297b diff --git a/effect.cpp b/effect.cpp index d0222de..74bd939 100644 --- a/effect.cpp +++ b/effect.cpp @@ -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) {