I have been trying to work out how/if you can use a shader to compute a value (once per frame) and use that value as a constant in the shader for the rest of the frame.
For example, I want to use a shader to find the minimum value in a texture once at the beginning of a each frame, then use that minimum value (probably as a uniform) in a fragment shader. It seemed to me I have two problems: 1. How do I get a shader (or part of a shader) to only execute once per frame? 2. How do I get the minimum value out of the shader in order to get the application to put it in a uniform? The only way I could think of to get a value out of a shader was to render its result to a texture and pick the data out of the texture in the application. Urgg.. there must be a better way. I had the idea that people may be using shaders as a general purpose 'rocket powered' implementation for all kinds of general algorithms, but I can't see how to use them in that way. Does OSG provide a way to use GLSL for anything other than 'colouring pixels' ;-) ? Chris. - The answers to stupid questions are often more enlightening than the answers to smart ones.
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

