is it already possible to use the “modular coding style” for shaders with the current drivers?
I’m asking that because I have this fragment pogram with its main() function that computes per pixel phong lighting. However the diffuse color and the opacity of the fragment is first obtained by the colorization of a greyscale texture. So I thought I could encapsulate both the texture fetch and colorization in a separate function that would be called from the main(). This would allow me to change the colorization function more easily while keeping the main() (that computes the lighting shader) untouched.
So first do you know if this is actually possible with current drivers? And if so, do I have to declare a separate shader object for each routine, one for the main(), one for the colorize() function, and then attach them both to a single program object, and then compile and link them, or do I have to place them both in a same .frag file?