Original Post
Hi, I am wondering how a function called outside of main in a vertex shader is handled. if we have a vertex shader like...
mat4 createMatrix()
{...}
mat4 test = createMatrix();
void main()
{...}
Q. Does the assignment mat4 test = createMatrix(); get calculated every vertex? Or just the once? I am basically looking at doing my OpenGL transformations(translate, rotate) within the Vertex shader and am trying to figure out the most efficient approach... 1. constructing transform matrix outside shader then passing in as a uniform, along with passing in the modelView/Projection. then do matri multiplication in the shader. 2. pass in transform values(translate, rotate) to shader, construct matrix here then do the same multiplications. Anyone advise would be appreciated. Thanks.