[Answered] Good math library for OpenGL

Started by
4 comments, last by l0calh05t 11 years, 7 months ago
Hi,

I've been recently searching for a good xna-like math library for C++ preferably OpenGL friendly without any good result. I'm a C# programmer who started to learn C++ two weeks ago, so that's why I don't like C++ libraries mapped from C (I can't stand and I'm not used to dirty code and not object-oriented programming). I found GLM and CML, but it seems like there aren't enough tutorials and documentation.


This is what I absolutely need:

-> 3D Vector class with math functions like the dot product and the cross product. Needs to be able to be transformed by a matrix.
-> 2D Vector class with basic math functions. Needs to be able to be transformed by a matrix.
-> Matrix4x4 (int, float, and/or double) class that with view, orthogonal and perspective projection, rotation, translation and scale functions.


Extra stuff:

-> Basic collision detection (view frustum, AAB, ray...)

Thank you for your help smile.png

Hide yo cheese! Hide yo wife!

Advertisement
I've used GLM. Header file only math library, the syntax is similar to the shader language GLSL though.
MathGeoLib has all of the things you mention. Also, you can find other math libraries listed here.

Hi,

I've been recently searching for a good xna-like math library for C++ preferably OpenGL friendly without any good result. I'm a C# programmer who started to learn C++ two weeks ago, so that's why I don't like C++ libraries mapped from C (I can't stand and I'm not used to dirty code and not object-oriented programming). I found GLM and CML, but it seems like there aren't enough tutorials and documentation.


This is what I absolutely need:

-> 3D Vector class with math functions like the dot product and the cross product. Needs to be able to be transformed by a matrix.
-> 2D Vector class with basic math functions. Needs to be able to be transformed by a matrix.
-> Matrix4x4 (int, float, and/or double) class that with view, orthogonal and perspective projection, rotation, translation and scale functions.


Extra stuff:

-> Basic collision detection (view frustum, AAB, ray...)

Thank you for your help smile.png


Consider the Bullet library. It has a linear math library that contains all of the math functions you mentioned, and it has direct support for openGL matrices. And since it is a physics library it also provides all of the collision detection you a likely to need :)

--www.physicaluncertainty.com
--linkedin
--irc.freenode.net#gdnet

I absolutely love Eigen. That said, it's more of a general-purpose linear algebra library than a "graphics math" library. Still, the syntax is hard to beat. Beautiful template magic.

I absolutely love Eigen. That said, it's more of a general-purpose linear algebra library than a "graphics math" library. Still, the syntax is hard to beat. Beautiful template magic.


I can only second the suggestion of Eigen. It's a great library. No projective transforms are included though, but it is easy enough to implement those.

This topic is closed to new replies.

Advertisement