I'dont know whether it's necessary to add function to get the pointer of mat_4_t
Closed this issue · 2 comments
mat4_t m;
printf("%p\n%p\n%p\n", &m, &m.m00, &m.m[0][0]);
Actually, To pass the matrix to shader, we can use three method to get the pointer.
I'dont know whether it will be better to add function or macro such as
#define m4_value(matrix) (&matrix.m00)
Hi iiRecord,
it really doesn't matter. Personally I just use &m. Adding a function for it might confuse users since it implies more magic than there is (e.g. I would expect that the value returned by m4_value() would be a value type and not a pointer).
Do you think it would be useful to mention in the documentation that you need to get the address of the matrix when using it with OpenGL functions? Right now the documentation only states that matrices are passed by value (struct) instead of by reference (array).
The code is so clean and easy to read, so when I use, I know how to get the address of the matrix. I won't be necessary to make some comment in the ducumentation.
Ok, I'll close the issue.