Hi, I need to access viewMatrix in the main program to compute another matrix(called cameraToLightSpace) that transforms the point from camera to light space. I then pass cameraToLightSpace matrix to the shader, because making this computation in the shader would be more expensive. How do I access viewMatrix in the main program and also ensure it is updated each draw call?
The equation I am using for the computation:
cameraToLightSpace = lightProjectionMatrix * lightVIewMatrix * inverse(viewMatrix);
Also I am using glMatrix API for these matrix computation. Is there a more efficient way to do the same?