Sign in to follow this  

math library?

This topic is 4598 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi everyone I wanted to know, is there any open source math library that I can use for opengl programs? I mean something with vector, matrices and quaternions to write programs like the milkshape animation tutorial..... I know that I can implement something by my own (the tut itself has math code) but is there something optimized? Something written and maintenent by programmers more skilled than me? What do you use? Thanks

Share this post


Link to post
Share on other sites
I'm sure there are a few open source ones about on sourceforge, or as part of another engine or lib. I use my own lib, http://www.robthebloke.org/code_dump/libMath.zip however i would consider switching to DirectX math lib if it wasn't for the amount of code i'd have to re-write....

Share this post


Link to post
Share on other sites
thanks for your response
the direct x math lib is not an option since I want to switch to linux so I want cross-platform code...... there are indeed some math libs there and there and also I have implemented some maths myself but I want something optimized speed-wise, full-featured and stable, very stable. You know, inline assembly and such, and to be as bug free as possible. I had a quick view at your lib thank you very much, I will look it more thorough later, but had you speed in mind when written it? Have you benchmarked it or something?
If am asking too much...... well sorry but I have spent hours and hours writting math code and always there is something that must be changed in order to work.

Cheers

Share this post


Link to post
Share on other sites
Well, I can't say mine is bug free, but I'm pretty sure it is... ;). Feel free to use it. I will be adding things to it as I encounter the neeed. The quaternion class implemented there isn't quite finished. But, it shouldn't be to hard to implement slerp/lerp and any other operation you need.

Also, I have used MathGL++ before. It has some things my lib doesn't (but I will be adding later), and it doesn't have some things my lib does have.

And, if you want an 'uber optimized SSE, SSE2' library for free, I once did some looking around, and really the only free option is the D3DX library that comes with DirectX. Anyways, unless you already have a good portion of whatever it is you are writing done, don't worry about an optimized math library. Once you do have a lot done, profile it and see if it really is the math operations that are the bottleneck, otherwise, don't worry about it.

[EDIT] So I decided to look at RobTheBloke's math lib and it is definitely more comprehensive than mine... Use his.

Slaru

[Edited by - Slaru on May 15, 2005 10:20:27 PM]

Share this post


Link to post
Share on other sites
I've been using and extending that lib for about 6 years. It was written for speed primarily, and i did at one point have a SIMD asm version. The asm was removed in favour of standard C++, simply for portability reasons (i use mac, linux, irix and Win32). I can think of a couple of minor optimisations I can make for specific cases, however the difference it will make will not be that great. For example, the matrix * matrix stuff could ignore the 4th column since it's always 0,0,0,1. Whilst in theory that may save you 25% of processing, that would probably only save you about 1-2 fps on the most complex scenes. Rendering the gometry takes a *LOT* longer than processing it.

well, i'm bored today (and away from my normal PC), so i'm going to spend a bit of time adding in a few specifics and some extra bits and bobs i've been meaning to do for a while.

Slaru: i had a look at your lib, have a look at my matrix and vector multiplication routines - they do the calculation slightly differently from the 'normal' method - the result is much more cache friendly...

[Edited by - RobTheBloke on May 16, 2005 7:02:53 AM]

Share this post


Link to post
Share on other sites
thanks both of you,

@slaru
your lib is almost what I had done only much better written (which means I am in the right path thankfully)

@rob
indeed, your lib looks very professional, I will dissect the code when I have some time, but it realy looks great

I found also libSIMD (http://libsimd.sourceforge.net/) and glmath (http://glmath.sourceforge.net/). Maybe I will have a look at them also and create a lib with the best features of each one........ it's what we all do after all eh?

Share this post


Link to post
Share on other sites

This topic is 4598 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this