Hi, No you can't do that directly. But you could load your shader file into a string and add your preprocessor definitions at the begining of it and then send it as source to the osg::Shader constructor:
std::string source = loadShaderFile(filename); source = "#define SIMPLE \n" + source; osg::Shader* shader = new osg::Shader(osg::Shader::VERTEX, source); Sebastian Messerschmidt a écrit : > Hello, > > I was wondering if the preprocessor language in GLSL is somehow useable > for osg. > Imagine I had a shader with > > .. > #ifdef SIMPLE > vec4 Color = vec4(1.0); > #else if NOT_SO_SIMPLE > vec4 Color = unimaginableComplicatedColorFunction(...) > #endif > > Can I pass those defines to osg::Shader? I didn't find anything. > So the only way to achive this is to modify the shader-code before > loading, right? > > cheers > Sebastian > > > .. > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or -- Lamoliatte Stephane Ingenieur R&D R.S.A. Cosmos Z.I. de la Vaure - B.P.40 42290 Sorbiers, France Tél : +33 (0)4 77 53 30 48 Fax : +33 (0)4 77 53 38 61 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

