Sign in to follow this  

Matrix library recommendations C/C++

This topic is 3863 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

I've been writing my own matrix library, just adding in the functions as and when I need them, but now I'm getting sick of writing it (all that maths gives me a headache). I figure there's got to be a decent, free matrix library out there somewhere with decent performance and a good variety of functionality. I figure that people with better programming/maths ability than me must have written some decent matrix libraries. Googling brings up surprisingly few results for actual usable libraries. It however brings up a million and one pages of someone saying they are going to develop a great new matrix library, usually dated several years ago. So what's everyone using? And why should I use it too?

Share this post


Link to post
Share on other sites
I write my own classes as I need them, but I give this link to people who want to know about matrices in regard to 3D graphics http://spec.winprog.org/pipeline/ . It explains the types of matrices used in graphics and has C++ code at the bottom. I use matrices for things other than 3D graphics though so I've written some more general classes that I use for solving systems and finding transformations based on control points etc. You'll probably get better search results if you include the application you're using the matrices for in your search.

Share this post


Link to post
Share on other sites
I mostly want the matrix library for OpenGL graphics - D3D has built in matrix classes, so it's less of an issue there. So ideally a column major library would be best (assuming it can't do both).

Thanks for the link, I'll give it a read, although the code is designed for D3D.

Share this post


Link to post
Share on other sites
Quote:
Original post by Damocles
I mostly want the matrix library for OpenGL graphics - D3D has built in matrix classes, so it's less of an issue there. So ideally a column major library would be best (assuming it can't do both).

Thanks for the link, I'll give it a read, although the code is designed for D3D.



An important note:

OpenGL and Direct3D matrices are compatible, despite the common misconception that they are not due to the column-major / row-major differences. The misconception stems from the fact that the documentation for each API uses different notation and that the API itself appears (outwardly) in similar fashion to the documentation (though that's probably a backwards way of describing it, its more likely that the docs mimic the APIs outward representation.) The internal layout of each matrix type, however, is identical and can be used interchangably.

That is to say; in a 4x4 matrix the translation vector lies in elements 12, 13 and 14, relative to the beginning of the matrix's storage, in either API.

Share this post


Link to post
Share on other sites

This topic is 3863 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