I am programming with just OpenGL and use GLM (OpenGL Mathematics). I found out that there is this extension in GLM called "GLM_GTC_constants" that should provide a list of built-in constants. This is how a function header looks in constants.hpp
:
/// Return the pi constant.
/// @see gtc_constants
template <typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType pi();
The function itself looks like this (constants.inl
):
template <typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi()
{
return genType(3.14159265358979323846264338327950288);
}
Now I'm wondering how to use this function.
glm::pi();
Using the function like above doesn't work.
float PI = glm::pi();
The code above, for example, gives me this error:
error: no matching function for call to ‘pi()’
I searched the documentation but did not find a usage example of those constants anywhere.
Type should be specified explicitly for using this templated function, since there's no argument deduction.
glm::pi<float>()
should do the trick
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With