Hi All,
I contemplate building matrices in the vertexshader, but wonder if there is an inherent way of detecting weather an input uniform (say camera-direction) has changed since the 'last' execution on the vertex? If I can detect that a change of direction has not happened, I can skip/spare a new calculation of the matrices ..
I'm also in doubt as to the 'scoop' of 'local variables' in the shader. Do they keep values between executions?
I would prefer to put the matrix-stuff in the shaders, but if I cannot bypass calculations it may be a better solution to manipulate that part in the application .. is there any rules-of-thumb on how to pick the right solution?
An obvious solution could be to send just one boolean uniform to controle the flow.
I've started out from an sample using freeglut. The sample did no more re-painting than necessary .. I don't know what changes causes the changed sample to do much more 'painting' than strictly necessary (as if the render() was placed in the idle-function). I could spare the GPU from unnecessary calculations by controlling the re-painting.
Any comments?
Yes, I'm brand new on opengl, c++ and shaders ;o/