[osg-users] Problem using osg::ColorMatrix

Gordon Tomlinson gordon.tomlinson at sensor.com
Mon Jul 28 07:41:27 PDT 2008


Having never used a ColorMatrix in OpenGL or OSG

What effect is this supposed to produce ?

Do you have screen grabs of what it should look like if done in raw Opengl ?
 

-----Original Message-----
From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Rahul Jain
Sent: Monday, July 28, 2008 10:40 AM
To: 'OpenSceneGraph Users'
Subject: [osg-users] Problem using osg::ColorMatrix

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