c - How to pass linmath.h matrices to glsl shader? -
i'm learning linmath.h
library, i'm having trouble passing matrices made in main program vert shader:
#include "linmath.h" … glint mat_uniform_handle = glgetuniformlocation(shade_program_handle, "matrix"); … mat4x4 m; mat4x4_identity(m); gluniformmatrix4fv(mat_uniform_handle, 1, gl_false, m);
but of course gives me type error because linmath
matrices have type float (*)[4]
, gluniformmatrix4fv
takes type const glfloat *
.
i tried writing own converter concated columns of matrix single array, returned pointer first element, didn't work.
am missing function of linmath.h
conversion me? if not, how convert linmath.h
matrix opengl matrix?
it's pathetic didn't try before asking here, here's solution, straight cast.:
gluniformmatrix4fv(mat_uniform_handle, 1, gl_false, (glfloat *)m);
hope helps someone.
Comments
Post a Comment