issue porting C++/glm/openGL to D/gl3n/openGL

Luis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jan 11 03:27:43 PST 2016


On Monday, 11 January 2016 at 10:04:29 UTC, Luis wrote:
> On Sunday, 10 January 2016 at 06:35:34 UTC, rsw0x wrote:
>> On Sunday, 10 January 2016 at 02:51:57 UTC, WhatMeWorry wrote:
>>>
>>> Just translating some simple C++/glm/opengl tutorial code to 
>>> D/gl3n/opengl and I'm coming across more friction than I 
>>> expected.  I've got a square centered at my window which is 
>>> rotated by 45 degrees (counter clockwise) and then moved to 
>>> the lower right quadrant.
>>>
>>> [...]
>>
>> iirc, gl3n uses row major and glm uses column major ordering
>> just pass GL_TRUE to the transpose argument in 
>> glUniformMatrix4fv
>
> If you like to check an D lib for vector/matrix/quaterntion 
> operations that uses column major ordering (ie, not need to 
> transpose), see this : https://github.com/Zardoz89/zmath
>
> Was just my D2 learning pet project... I never checked if it 
> was math correct, and I don't updated in a lot of time (5 years 
> ago), plus there isn't documentation beyond comments and a few 
> unit-tests, so use at your risk.
> But at least I know that was working correctly with Derelict2 
> when I wrote it.
>
> Perhaps I should retake this...

I just remember why I never retake this ... Use gl3n, row-major 
math operations outperforms a lot, if you are doing any matrix 
multiplication on CPU side ( 
http://eli.thegreenplace.net/2015/memory-layout-of-multi-dimensional-arrays/ )


More information about the Digitalmars-d-learn mailing list