PDA

View Full Version : GLM fast sqrt functions ambiguity



overTaker
06-17-2014, 04:21 AM
Hello.

I would like to use some of fast* functions of GLM framework (latest version for this day), but I can't overpass ambiguity problem.
It always screams that function is ambiguous, even if I specify ridiculously precise types, for example:


glm::mediump_float32 dist = glm::fastDistance(glm::mediump_f32vec2(destination .x, destination.z), glm::mediump_f32vec2(loc.x, loc.z));

gives me error


more than one instance of overloaded function "glm::fastDistance" matches the argument list:
function template "genType::value_type glm::fastDistance(const genType &x, const genType &y)"
function template "genType glm::fastDistance(const genType &x, const genType &y)"
argument types are: (glm::mediump_f32vec2, glm::mediump_f32vec2)

I believe I miss something small, but I can't find it. What should I do to make it work?

carsten neumann
06-17-2014, 05:14 AM
Untested, but if you're lucky specifying the template argument yourself resolved the ambiguity:



glm::mediump_float32 dist = glm::fastDistance<glm::mediump_f32vec2>(glm::mediump_f32vec2(destination.x, destination.z), glm::mediump_f32vec2(loc.x, loc.z));


However, if I read it correctly the two function templates the compiler sees essentially only differ in return type, so even this may not be enough. Perhaps worth opening a glm bug report over at glm github issues page (http://github.com/g-truc/glm/issues).

overTaker
06-17-2014, 12:06 PM
Unfortunatelly still no luck.
I too noticed, that only returning type differs. Also the thing is, the function which returns genType isn't even documented at their website. It only mentions the one with genType::value_type.

I guess I will try luck in there. I spend like half an hour trying to get it to work, including googling, but nothing helped.
Thanks!