[osg-users] Centroid Varying Shader Variable

Mike Weiblen mike.weiblen at gmail.com
Tue Jul 8 16:17:28 PDT 2008


On Mon, Jul 7, 2008 at 5:16 PM,  <paul1492 at yahoo.com> wrote:
...
> You would have thought that a 1.2 compiler would be able to compile all earlier version of the language but they decided to implement it such you must tell the compile your using 1.2 of the language.

the rationale is that the shader author must declare their intent to
use newer/extended features of the language, to enhance portability of
shader code across different GLSL implementations.

> Also, about the CPP part of my question, I see the shader language supports many of these directives.. Is there any way to externally (i.e. in OSG) to set a "#define" variable?? For example, With the CPP, I use "cpp -DVariable=10 infile.txt outfile.txt". And then I'd do a:
>     fragProgram->loadShaderSourceFromFile("outfile.txt");
> Do I have to create a "#define Variable 10" string and prepend it to my shader code (which isn't easy if I use "loadShaderSourceFromFile()"). Is there some other way? Anybody use the shader's conditional compile directives?
> Paul P.

No there's not a "compler cmdline" feature to add define flags.  I
dont use the GLSL preprocessor much, tho does seem there's opportunity
 to improve OSG's interface for that usemodel.

-- mew



-- 
Mike Weiblen -- Austin Texas USA -- http://mew.cx/



More information about the osg-users mailing list