Introducing: ROML

What is ROML?

Remember when I said that I wouldn’t use GLM when learning OpenGL in my last post? Well this is it, ROML. Rangga’s Opensource Maths Library. It’s a maths graphic library just like GLM but with only one contributor and possibly worse. To make this even harder I tried to not look at GLM’s source code and only used it if I was really struggling but I always made sure I understood everything I wrote. Since I am the only person working on this and I’m 13 and don’t know a ton about maths I just decided to make functions that were needed to complete the OpenGL guide. In the end, I found it pretty fun to see how everything works behind the scenes and was a great oppurtunity to learn some math that I didn’t know previously.

What changes from GLM?

As much as I would like to seperate different functions into different header files I decided to stuff them all into one header file and create a namespace so that the compiler wouldn’t get confused when using the functions. Although I could’ve created my own types, I used GLM types instead (vec3, mat4 etc.) to create the library. Technically, most of it will feature similar content to the already existing GLM functions since mathematically they would be the same/similar anyway. I only used one extra library (excluding GLM types) which was cmath so I could calculate the vectors and matrices easily rather than editing and calculating each element individually.

Available Functions

  • Translate degrees to radians
  • Normalize a vector
  • Rotate a 4x4 matrix
  • Rotate a 3 length vector
  • Negate (or reverse) values of a vec3
  • Find an angle between two vectors
  • Find cross product between two vectors
  • Create a view matrix
  • Create a projection matrix (not ortographic)
  • Inverse square root (I think cmath already has this though)
  • Camera lookat(); function which allows the use of a camera in a 3D space
  • Dot product of two vectors