Not sure if there is a stand supported api for a matrix class, it would be appreciated if someone could recommend one. I’d assume the api would also include quaternion. Sorry if there is an obvious answer, I googled but didn’t get any hits.
There are several 3D math libraries out there.
What I personally use is GLM: http://glm.g-truc.net/
This question is handled in the wiki:
But don’t forget this library:
It (EDIT: sometimes) outperforms glm and is less cluttered with GL-specific stuff (i.e. you can also use it in a DirectX project).
i.e. you can also use it in a DirectX project
There’s nothing stopping you from using GLM in a D3D project. It doesn’t make any OpenGL API calls. Vectors and matrices are platform-agnostic.
Well, you can and it even has some fast assembly matrix and vector code. Use depends on taste and benching.
I think it used to have some GL-specifics in an older version and I didn’t bother to check.
I don’t want to start the flame war again whether tvmet or GLM is better, but…
As Alfonse said, you can use GLM with OpenGL, D3D or in whatever context you wish. It is a standalone math library. The only thing that makes GLM somewhat related to OpenGL is that it uses the same naming conventions and rules like those of GLSL thus it has kind of a standard interface. Also, if you work with OpenGL it feels more natural to work with GLM than any other math library thanks to the similar/matching conventions.
Please no flame-war again. I don’t have wiki-access, or I’d have added it a long time ago to the wiki. Only bench and real-life test will give a definite answer; sometimes it is good to have alternatives to choose from.
ugluk, you should be able to create an account on the GL wiki.
Anyone and everyone is able to contribute to the Wiki. You just need to create an account.
I don’t have wiki-access, or I’d have added it a long time ago to the wiki.
I just added it for you.
If you’re so inclined, you could even use the D3DX stuff with OpenGL. OK, it’s most definitely not portable, but if you’re doing a project that has both OpenGL and D3D renderers, it’s a viable option.
Thanks for the help, I ended up using glm as I don’t have to worry about compatibility with glsl. I was thinking about using directx but that would defeat the purpose entirely of using opengl :P.