Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uniform instance for M44 wrongly treats it as column major #51

Open
raymoo opened this issue Jan 19, 2018 · 3 comments
Open

Uniform instance for M44 wrongly treats it as column major #51

raymoo opened this issue Jan 19, 2018 · 3 comments

Comments

@raymoo
Copy link

raymoo commented Jan 19, 2018

It looks like the Uniform instance for the M44 Float (an alias for V4 (V4 Float)) type from linear assumes a column-major format, but linear itself treats it as row-major. In particular functions such as mkTransformation, lookAt, or perspective that produce matrices with translation components will behave most obviously badly. The rotation component of matrices likely suffer from reversed rotation directions (I did not test for this problem).

@hadronized
Copy link
Owner

Hm, I didn’t have any issue with this – I don’t annotate my shaders with any major things. Do you have an example of problematic code? Thanks for reporting, by the way! ❤️

@raymoo
Copy link
Author

raymoo commented Jan 19, 2018

It was for an assignment, so I can't post the code as-is, but the Storable instance for M44 (used at https://hackage.haskell.org/package/luminance-0.11.0.4/docs/src/Graphics-Luminance-Core-Shader-Program.html#line-823) will end up storing it in row major order, while OpenGL's matrix-uniform-setting functions assume a column major order.

I can try to whip up an example this weekend.

@raymoo
Copy link
Author

raymoo commented Jan 31, 2018

Sorry for lagging on writing a broken example.

Is there an example somewhere of sending camera matrices as uniforms and using them in the shader?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants