Is it possible to split a big vertex/fragment
Source program to small vertex/fragment source
Program files?
let say I have big.vert & big.frag that contain

...
main(){

..
f1();
f2();
f3();
f4();

...
}
f1() - f4() ... - implementation

and I want to split/move f1()-f4() to different
source file (f1.vert,f1.frag,f2.vert,f2.frag...)

Thanks
Amir

Humus

11-07-2006, 08:13 AM

Should be no problem. Just load all the files you need and pass multiple strings to glShaderSourceARB().

k_szczech

11-07-2006, 08:37 AM

In GLSL every fragment/vertex program can be made of multiple fragment/vertex shader objects.
Each one of such shader objects would represent one source file.

Amir Meteraso

11-07-2006, 09:08 AM

Thanks!.
Thanks!.
Do you know if it's possible to combine different
vertex/vertex program (made of different vertex/fragment object, taken from different source file) in the same rendering pass?
say i have my own lighting shader program (made from different shader/fragment object/source)
and i want to add another vertex/fragment program that operates on this shader program results.

k_szczech

11-08-2006, 01:34 AM

No, you can't combine program objects directly, but you could render first pass to texture and use this texture in second pass when rendering to screen.
But what you probably need is something like this:
Fragment program 1:
-fragment shader 1 - main() - calls f1()
-fragment shader 2 - f1()

This way your main() function is always the same, but you just link different combinations of fragment shaders with functions f1() and f2(). So, program 1 has only one effect enabled and program 2 has both effects enabled.