Hi all,
Can someone explain what can cause a shader to not compile? I have a two
programs with nearly identical build systems, using the same OSG libraries
(3.1.1) on the same machine. One can compile and run shaders, while the other
produces this:
Code:
Compiling VERTEX source:
1: // microshader - colors a fragment based on its position
2: varying vec4 color;
3: void main(void)
4: {
5: color = gl_Vertex;
6: gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
7: }
VERTEX glCompileShader "" FAILED
Compiling FRAGMENT source:
1: varying vec4 color;
2: void main(void)
3: {
4: gl_FragColor = clamp( color, 0.0, 1.0 );
5: }
FRAGMENT glCompileShader "" FAILED
Linking osg::Program "" id=0 contextID=0
glLinkProgram "" FAILED
I am invoking it in a standard way like this:
Code:
osg::Geode* geode = new osg::Geode();
geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(1,1,1), 1)));
root->addChild(geode);
osg::Program * prog = new osg::Program;
prog->addShader ( new osg::Shader(osg::Shader::VERTEX, microshaderVertSource )
);
prog->addShader ( new osg::Shader(osg::Shader::FRAGMENT, microshaderFragSource
) );
geode->getOrCreateStateSet()->setAttributeAndModes( prog,
osg::StateAttribute::ON );
It has to be something in my scene graph. Some state being inherited, or some
setting that I'm unaware of. Any help would be greatly appreciated.
Extra info:
OSX=10.7.3, osgversion=3.1.1, GPU=nvidia GeForce 8600M GT
glVersion=2.1, isGlslSupported=YES, glslLanguageVersion=1.2
Thanks,
Mike
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47118#47118
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org