polylineBlobsExample not compiling with glm

after updating glm to, ofPolyline does not compile anymore when used, because there is no matching function for call to ‘lerp(const vec3&, const vec3&, float&)’

/home/xxx/openFrameworks/libs/openFrameworks/graphics/ofPolyline.inl:533:9:   required from ‘ofPolyline_<T> ofPolyline_<T>::getResampledByCount(int) const [with T = glm::vec<3, float, (glm::qualifier)0>]’
/home/xxx/openFrameworks/examples/graphics/polylineBlobsExample/src/ofApp.cpp:47:51:   required from here
/home/xxx/openFrameworks/libs/openFrameworks/graphics/ofPolyline.inl:961:18: error: no matching function for call to ‘lerp(const vec3&, const vec3&, float&)’
  return glm::lerp(toGlm(leftPoint), toGlm(rightPoint), t);
In file included from /home/xxx/openFrameworks/libs/glm/include/glm/./gtc/../gtc/../ext/quaternion_common.hpp:120,
                 from /home/xxx/openFrameworks/libs/glm/include/glm/./gtc/../gtc/quaternion.hpp:20,
                 from /home/xxx/openFrameworks/libs/glm/include/glm/./gtc/type_precision.hpp:17,
                 from /home/xxx/openFrameworks/libs/glm/include/glm/./gtc/bitfield.hpp:23,
                 from /home/xxx/openFrameworks/libs/glm/include/glm/ext.hpp:114,
                 from /home/xxx/openFrameworks/libs/openFrameworks/math/ofVectorMath.h:21,
                 from /home/xxx/openFrameworks/libs/openFrameworks/ofMain.h:37,
                 from /home/xxx/openFrameworks/examples/graphics/polylineBlobsExample/src/ofApp.h:3,
                 from /home/xxx/openFrameworks/examples/graphics/polylineBlobsExample/src/ofApp.cpp:1:
/home/xxx/openFrameworks/libs/glm/include/glm/./gtc/../gtc/../ext/quaternion_common.inl:29:31: note: candidate: ‘template<class T, glm::qualifier Q> glm::qua<T, Q> glm::lerp(const glm::qua<T, Q>&, const glm::qua<T, Q>&, T)’
  GLM_FUNC_QUALIFIER qua<T, Q> lerp(qua<T, Q> const& x, qua<T, Q> const& y, T a)
/home/xxx/openFrameworks/libs/glm/include/glm/./gtc/../gtc/../ext/quaternion_common.inl:29:31: note:   template argument deduction/substitution failed:
In file included from /home/xxx/openFrameworks/libs/openFrameworks/graphics/ofPolyline.h:553,
                 from /home/xxx/openFrameworks/libs/openFrameworks/gl/ofGLRenderer.h:3,
                 from /home/xxx/openFrameworks/libs/openFrameworks/ofMain.h:49,
                 from /home/xxx/openFrameworks/examples/graphics/polylineBlobsExample/src/ofApp.h:3,
                 from /home/xxx/openFrameworks/examples/graphics/polylineBlobsExample/src/ofApp.cpp:1:
/home/xxx/openFrameworks/libs/openFrameworks/graphics/ofPolyline.inl:961:18: note:   ‘const vec3’ {aka ‘const glm::vec<3, float, (glm::qualifier)0>’} is not derived from ‘const glm::qua<T, Q>’
  return glm::lerp(toGlm(leftPoint), toGlm(rightPoint), t);
Compiling /home/xxx/openFrameworks/addons/ofxOpenCv/src/ofxCvHaarFinder.cpp
make[1]: *** [/home/xxx/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:215: obj/linux64/Release/src/ofApp.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [/home/xxx/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:129: Release] Error 2
Compilation Failed!

I’m on Debian 10 (Buster), compiling with clang-8

PS: as the cause is the same of this other thread, should we make a single thread for testing and fixing glm ?

or maybe it’s better to discuss this on a github issue ( i found more than one ) ?

yeah better to discuss this on a github issue, if you want to even start a pull request that would be really useful as well. I opened a PR in the apothecary repo a while ago to update glm to https://travis-ci.org/openframeworks/apothecary/builds/552908870?utm_source=github_status&utm_medium=notification but haven’t merged it yet cause it was failing for other reasons

1 Like

ok, i wrote down everything that doesn’t work in the apothecary PR, i gave a look at the ofPolyline code but i haven’t any big experience with glm, so i have no clue on how to fix all this templated stuff, sorry

no problem if you start a PR feel free to ask any doubts you might have

glm needs to have GLM_ENABLE_EXPERIMENTAL defined to enable glm::lerp.
You can replace glm::lerp by glm::mix in polyline.inl (with the same arguments) and it should work.

@oxillo, yes there’s already a PR here: https://github.com/openframeworks/openFrameworks/pull/6366 if you know of any other problems can you post them there? thanks!

I’ve seen some problems with glm::mat constructors. I’ll try to contribute to the PR.

1 Like