C++ GLM(OpenGL Mathematics) D Equivalent.

WhatMeWorry kheaser at gmail.com
Fri Sep 7 16:54:08 UTC 2018


On Tuesday, 4 September 2018 at 19:40:10 UTC, JN wrote:
> On Tuesday, 4 September 2018 at 19:23:16 UTC, SrMordred wrote:
>> Most C++ game related projects uses GLM as they default 
>> math/vector lib (even if not using opengl).
>>
>> In D we have (that I found):
>>
>> gfm.math  - https://github.com/d-gamedev-team/gfm
>> dlib.math - https://github.com/gecko0307/dlib
>> Gl3n      - https://github.com/Dav1dde/gl3n
>>
>> But i'm not sure which to pick.
>>
>> Can someone point me out some reasons to use one over the 
>> other? (or show some differences)
>>
>> I´m expecting something of equivalent functions and 
>> performance as c++ glm.
>>
>> Thank you!
>
> I use dlib.math for my 3D engine. It's working fairly well, 
> can't complain. No clue about gfm. Gl3n is nice, but it has a 
> design flaw - it's using row-major matrix ordering. It may or 
> may not be a big deal for you, but in general, it means that 
> all matrices being sent to OpenGL need to be transposed, and 
> the matrix multiplication order is reversed.
>
> Another advantage of dlib.math is that it has some extended 
> features, such as support for calculating tangents for a mesh.

I've used gl3n exclusively for years, but just call opengl 
functions with the "transpose" argument set to true. Or for 
readability, I define: alias ROW_MAJOR = GL_TRUE;

glUniformMatrix4fv(glGetUniformLocation(this.ID, name), 1, 
ROW_MAJOR, &matrix[0][0]);

However, in hindsight, I think gfm.math might be the way to go.



More information about the Digitalmars-d-learn mailing list