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

Matrices cannot be converted to other matrices #205

Closed
mfiano opened this issue Jun 8, 2018 · 2 comments
Closed

Matrices cannot be converted to other matrices #205

mfiano opened this issue Jun 8, 2018 · 2 comments
Labels
merged-issue To mark an issue that, whilst valid, has been into another issue

Comments

@mfiano
Copy link

mfiano commented Jun 8, 2018

Varjo: There is no applicable method for the glsl function 'MAT3'
when called with argument types:
(:MAT4)

The OpenGL wiki states:

A matrix can be constructed from another matrix A matrix can only be constructed from a single other matrix. The column and row values from the input matrix are copied to their corresponding values in the output; any values of the output not filled in are filled with the identity matrix.

Therefore:

 mat3 diagMatrix = mat3(5.0);  // Diagonal matrix with 5.0 on the diagonal.
 mat4 otherMatrix = mat4(diagMatrix);
The otherMatrix is a diagonal matrix, where the first 3 values are 5.0, and the last diagonal value is 1.0.

There are no restrictions on size when doing matrix construction from another matrix. So you can construct a 4x2 matrix from a 2x4 matrix; only the corresponding elements are copied.
@mfiano
Copy link
Author

mfiano commented Jun 8, 2018

This gist addresses issues #205 #206 and #207 if you want to copy/paste and ensure I didn't make any mistakes: https://gist.github.com/mfiano/78628dfa7251aba5aef89d7ac587c791

@cbaggers cbaggers added the merged-issue To mark an issue that, whilst valid, has been into another issue label Jul 1, 2018
@cbaggers
Copy link
Owner

cbaggers commented Jul 1, 2018

Thanks for the report. Merging these matrix type constructor issues into #209

@cbaggers cbaggers closed this as completed Jul 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-issue To mark an issue that, whilst valid, has been into another issue
Projects
None yet
Development

No branches or pull requests

2 participants