Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are you aware of a complete (or almost complete) cross platform math library for use in OpenGL ES 2.0 games?

The library should contain:

  • Matrix2x2, Matrix 3x3, Matrix4x4 classes
  • Quaternions
  • Vector2, Vector3, Vector4 Classes
  • Euler Angle Class
  • Operations amongh the above mentioned classes, conversions, etc..
  • Standardly used math operations in 3D graphics (Dot Product, Cross Product, SLERP, etc...)

Is there such Math API available either standalone or as a part of any package?

Programming Language: Visual C++ but planned to be ported to OS X and Android OS.

share|improve this question

closed as off-topic by Byte56 Mar 15 '14 at 16:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about "how to get started," "what to learn next," or "which technology to use" are discussion-oriented questions which involve answers that are either based on opinion, or which are all equally valid. Those kinds of questions are outside the scope of this site. Visit our help center for more information." – Byte56
If this question can be reworded to fit the rules in the help center, please edit the question.

@Josh: thanks for editing – Bunkai.Satori Feb 7 '11 at 20:29
There is no perfect math library for now, I just tried to write few requirements and just no library have them, well in the reality I'd like someone make a library easy as GLM with same function as shaders + the style of Ogre math library and some of its functionalities (that GLM is missin like view frustum, bounding boxes etc.) Also note that GLM is not that fast (in reality that does not matters) so i doubt someone will use it in raytracers or intensive stuff, is more usefull because of its API and design style – DarioOO Jul 2 '14 at 13:46
up vote 14 down vote accepted

Have you considered the Configurable Math Library?

share|improve this answer
+1 @Josh: Thanks for your good tip. I am currently considering GLM ( GL Math library. I will wait to see what libraries people arlready have tried and have been proven as good. – Bunkai.Satori Feb 7 '11 at 20:28
Id strongly recommend GLM. I use it and its "awesome" – brainydexter Feb 8 '11 at 6:45
+1, I like CML a lot and would have posted that as an answer =). It does, however, depend a lot on the optimizations of the compiler, as it's generic and template based. If you're targeting a mobile device (likely as you quoted ES), some other math library may be better optimized for the target. – Jari Komppa Feb 8 '11 at 8:26
Hi Brainy, Jari, thanks for your comments. I would still like to see, if there are more options with user feedback available, therefore, I wish to keep this question open for a while. – Bunkai.Satori Feb 8 '11 at 12:19
@Jari - when discussing Math Library Optimization for OpenGL ES platform, what is included? I mean, if formula and data types are properly designed what else can be done to optimize the library for ES platform? (It might be elementary question, but I do not have answer for that.) – Bunkai.Satori Feb 8 '11 at 12:20

Eigen is a C++ header only math library that supports SSE, AltiVec and ARM Neon vectorisation.

share|improve this answer
+1 for great tip. Hi Simon, thanks for your great tip. I started using GLM (OpenGL Math Library), and it is pretty amazing. It contains everything from vector, matrix, quaternion math, SLERP interpotations, etc... so far, it offers more than I realy need, so I am happy with it for now. – Bunkai.Satori May 25 '11 at 13:22

Here are 2:

  1. Sony's vectormath
  2. Bullet's Linearmath
share|improve this answer
+1 for good tips. Hi Maik, thanks for your comments. In my opinion, the second might be useful especially when the game integrates Bullet Physics. My game is going to use Bullet Physics, but unfortunatelly, I have started using GLM, so I will try to stick to GLM. – Bunkai.Satori May 25 '11 at 13:26

I worked on adding Apple's GLKMath to the this test (actually forked this fork)

Here's the result on my 4 Generation iPod Touch:

Additions: 77624 milliseconds.
Multiplications: 227179 milliseconds.

Additions: 23935 milliseconds.
Multiplications: 80599 milliseconds.

Additions: 102390 milliseconds.
Multiplications: 161059 milliseconds.

Additions: 8526 milliseconds.
Multiplications: 21775 milliseconds.

Here's my code

I don't have an Android Device, but I'm curious how GLKMath will perform on Android.

share|improve this answer
+1 for hard nubmers – Eonil Jun 14 '13 at 5:42

This is an old question, but I came across a very recent article that addresses just this issue by taking into consideration performance, documentation, ease-of-use, etc...

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.