Re: [osg-users] Problem using osg::ColorMatrix

2008-07-29 Thread Sebastian Messerschmidt

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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

  



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem using osg::ColorMatrix

2008-07-29 Thread Rahul Jain
Hi Ulrich,
Thanks for the reply, you are absolutely right, color matrix is part of
imaging subset which is used during pixel transfer operation. The
concept just slipped out of my mind ;)
thanks for the correcting my thoughts
cheers
RJ

Ulrich Hertlein wrote:
 Hi Rahul,

 Rahul Jain wrote:
  Color matrix in OpenGL is used for color space conversion, for example
  using color matric you can convert RGB to BGR , RGB to CMY.
  Unfortunately i do not have any screen grabs for the moment, but i am
  trying to achieve night vision effect using this code ,

 doesn't the color matrix only affect pixel transfer operations?  Like
 texture upload/download, framebuffer reads and such?  So you can't use
 it to modify object appearance on the fly.

 /ulrich
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Problem using osg::ColorMatrix

2008-07-28 Thread Rahul Jain
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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem using osg::ColorMatrix

2008-07-28 Thread Gordon Tomlinson
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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem using osg::ColorMatrix

2008-07-28 Thread Rahul Jain
Hi Gordon,
Color matrix in OpenGL is used for color space conversion, for example
using color matric you can convert RGB to BGR , RGB to CMY.
Unfortunately i do not have any screen grabs for the moment, but i am
trying to achieve night vision effect using this code ,
RJ

Gordon Tomlinson wrote:
 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: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] 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@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


   

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Problem using osg::ColorMatrix

2008-07-28 Thread Ulrich Hertlein

Hi Rahul,

Rahul Jain wrote:
 Color matrix in OpenGL is used for color space conversion, for example
 using color matric you can convert RGB to BGR , RGB to CMY.
 Unfortunately i do not have any screen grabs for the moment, but i am
 trying to achieve night vision effect using this code ,

doesn't the color matrix only affect pixel transfer operations?  Like texture 
upload/download, framebuffer reads and such?  So you can't use it to modify 
object appearance on the fly.


/ulrich
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org