Why does this code compile
[[nodiscard]] glm::mat4 rotationX(double theta)
{
return glm::rotate(glm::mat4(1.0), static_cast<float>(theta), glm::vec3(1.0, 0.0, 0.0));
}
and this one not
[[nodiscard]] glm::mat4 rotationX(double theta)
{
return glm::rotate(glm::mat4(1.0), theta, glm::vec3(1.0, 0.0, 0.0));
}
it results in error C2672 no matching overloaded function found and
Error C2782: Template parameter T is ambigous.
what type should theta be?
Also this code
[[nodiscard]] glm::mat4 shearing(double xy, double xz, double yx, double yz, double zx, double zy)
{
auto sh = glm::mat4(1.0);
sh[1][0] = xy;
sh[2][0] = xz;
sh[2][1] = yz;
sh[0][1] = yx;
sh[0][2] = zx;
sh[1][2] = zy;
return sh;
}
produces the following warning:
warning C4244: 'argument' : conversion from 'double' to 'T', possible loss of data
I can't understand what exactly the error is, because everything else seems to work.
PS, I include
#include <glm/fwd.hpp>
in .hpp and
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
in .cpp.