[osg-users] multiple pixel shaders for one program ?

2009-11-30 Thread Sebastien Nerig
Hi, I would like to know if it is possible to do that : Code: osg::Program* program = new osg::Program; osg::Shader* shader = new osg::Shader(osg::Shader::FRAGMENT); shader-loadShaderSourceFromFile(main.frag); program-addShader(shader); osg::Shader* shader1 = new

Re: [osg-users] multiple pixel shaders for one program ?

2009-11-30 Thread Robert Osfield
HI Sebastien, You can have multiple vertex, geometry and fragment osg::Shaders attached to a single osg::Program. All you need to do is make sure that just one of the osg::Shaders contains the main for each of the vertex, geometry and fragment components of the program - from you example it

Re: [osg-users] multiple pixel shaders for one program ?

2009-11-30 Thread Sebastien Nerig
Hi robert thx for your answer Ok I tried what you said, but I still have a pb. I made a shader common.frag with a basic fog function Code: uniform vec3 fogColor; uniform float fogDensity; vec3 fog(in vec3 color) { const float LOG2 = 1.442695; float z = gl_FragCoord.z / gl_FragCoord.w;

Re: [osg-users] multiple pixel shaders for one program ?

2009-11-30 Thread Kim Bale
Hi Sebastian, Declare the function stub in the main.frag vec3 fog(in vec3 color); void main().. K. 2009/11/30 Sebastien Nerig overse...@hotmail.com: Hi robert thx for your answer Ok I tried what you said, but I still have a pb. I made a shader common.frag with a basic fog function

Re: [osg-users] multiple pixel shaders for one program ?

2009-11-30 Thread Sebastien Nerig
you right ! Thank you! Cheers, Sebastien -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=20585#20585 ___ osg-users mailing list osg-users@lists.openscenegraph.org

Re: [osg-users] multiple pixel shaders for one program ?

2009-11-30 Thread Paul Martz
Just a note for the archives, for people who come across this later... This is not really an OSG topic per se, so I wanted to make sure that people were aware of the orange book: OpenGL Shading Language. And also the GLSL spec is absolutely free for download as a PDF from opengl.org. Shader