Hi
try to declare array as "Intensity[0]" in uniform description like:
osg::Uniform* arrayIntensity=new
osg::Uniform(osg::Uniform::Type::FLOAT_VEC3,"Intensity[0]",2);
it should work either way, but there've been some drivers problems with those
on nvidia cards.
Cheers.
19.03.2013, 15:50, "Andrea Martini" <[email protected]>:
> Hi Sebastian,
> sure, i have forgotten to report the following code line in the previous
> message (but this code line is present in the osg code):
>
> stateset->addUniform(arrayIntensity);
>
> so the osg code is :
>
> Code:
>
> program->addShader(vertexShader);
> program->addShader(fragShader);
> osg::StateSet* stateset=myModel->getOrCreateStateSet();
> stateset->setAttributeAndModes(program);
> stateset->addUniform(new osg::Uniform("Kd",osg::Vec3(1.0,1.0,1.0)));
> stateset->addUniform(new osg::Uniform("Ks",osg::Vec3(1.0,1.0,1.0)));
> stateset->addUniform(new osg::Uniform("Ka",osg::Vec3(1.0,1.0,1.0)));
> stateset->addUniform(new osg::Uniform("Shininess",50.0f));
>
> osg::Uniform* arrayIntensity=new
> osg::Uniform(osg::Uniform::Type::FLOAT_VEC3,"Intensity",2);
> arrayIntensity->setElement(0,osg::Vec3f(1.0,1.0,1.0));
> arrayIntensity->setElement(1,osg::Vec3f(1.0,0.5,1.0));
>
> osg::Uniform* arrayPosition=new
> osg::Uniform(osg::Uniform::Type::FLOAT_VEC4,"Position",2);
> arrayPosition->setElement(0,osg::Vec4(0.0,1.0,0.0,0.0));
> arrayPosition->setElement(1,osg::Vec4(0.0,-1.0,0.0,0.0));
>
> stateset->addUniform(arrayIntensity);
> stateset->addUniform(arrayPosition);
>
> I'm wondering if the problem could depend on osg version.
>
> Thank you!
>
> Cheers,
> Andrea
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=53156#53156
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org