[osg-users] Problem using osg::ColorMatrix

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Mon Jul 28 23:10:13 PDT 2008


Hi Rahul. If I recall correctly the color matrix isn't working on most
consumer cards. You need the the GL_ARB_IMAGING extension.
Alternatively you can achieve the desired effect with a shader.

cheers
psy
> Hi all,
> I am trying to use OpenFL color matrix functionality through
> osg::ColorMatrix but not able to do so. When i apply this to a node
> |(cessna.osg) i do not see any effect. I am pasting the code below for
> you guys to have a look.
> I don't  know what am i doing wrong in this simple piece of code .
> cheers RJ
>
>
> int main(int argc, char** argv)
> {
>     osg::MatrixTransform* cessnaMT = new osg::MatrixTransform;
>
>     
>     osg::Node* cessna = osgDB::readNodeFile("cessna.osg");
>     cessnaMT->addChild(cessna);
>
>      // Set color matrix
>     osg::ColorMatrix* colorMatrix = new osg::ColorMatrix;
>     const osg::Matrix cm (0.15, 0.0, 0.0, 0.0,
>                           0.0,  0.3, 0.0, 0.0,
>                           0.05, 0.0, 0.0, 0.0,
>                           0.0,  0.0, 0.0, 1.0);
>
>     colorMatrix->setMatrix(cm);
>
>     cessnaMT->getOrCreateStateSet()->setAttributeAndModes(colorMatrix,
>              osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
>
>     osgViewer::Viewer viewer;
>
>     // add model to viewer.
>     viewer.setSceneData(cessnaMT);
>
>     viewer.run();
>
>     return 0;
>
> }
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>   





More information about the osg-users mailing list