Using glsl classes outside of shader files

Is there a way to use glsl classes like vec3 and vec2 etc, within the source program code or is it exclusive to the shader files?

I’m trying to avoid having to write my own vector class complete with normalization, dot and cross product methods etc etc…

Use GLM. It’s a 3d math library with syntax based on GLSL specification, so you can use stuff like vec2, vec3, mat4, normalize in C++ code just like you would use them in GLSL (I assume you use C++).

Just in case here’s the glm link

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.