Hi,
I'm studying OSG with Beginner's Guide Book.
But I did not learn about OpenGL.
First, let me show you the code related questions.
Code:
#include osg/MatrixTransform
#include osg/LightSource
#include osgDB/ReadFile
#include osgViewer/Viewer
osg::Node* createLightSource( unsigned int num,
const osg::Vec3 trans,
const osg::Vec4
color )
{
osg::ref_ptrosg::Light light = new osg::Light;
light-setLightNum( num );
light-setDiffuse( color );
light-setPosition( osg::Vec4( 0.0f, 0.0f, 0.0f, 1.0f ) );
osg::ref_ptrosg::LightSource lightSource = new osg::LightSource;
lightSource-setLight( light );
osg::ref_ptrosg::MatrixTransform sourceTrans = new
osg::MatrixTransform;
sourceTrans-setMatrix( osg::Matrix::translate( trans ) );
sourceTrans-addChild( lightSource.get() );
return sourceTrans.release();
}
int main( int argc, char** argv )
{
osg::ref_ptrosg::Node model = osgDB::readNodeFile( cessna.osg );
osg::ref_ptrosg::Group root = new osg::Group;
root-addChild( model.get() );
osg::Node* light0 = createLightSource( 0, osg::Vec3( -20.0f, 0.0f,
0.0f ), osg::Vec4( 1.0f, 1.0f, 0.0f, 1.0f ) );
osg::Node* light1 = createLightSource( 1, osg::Vec3( 0.0f, -20.0f,
0.0f ), osg::Vec4( 0.0f, 1.0f, 1.0f, 1.0f ) );
root-getOrCreateStateSet()-setMode( GL_LIGHT0,
osg::StateAttribute::ON );
root-getOrCreateStateSet()-setMode( GL_LIGHT1,
osg::StateAttribute::ON );
root-addChild( light0 );
root-addChild( light1 );
osgViewer::Viewer viewer;
viewer.setSceneData( root.get() );
return viewer.run();
}
In the code, GL_LIGHT0 and GL_LIGHT1 is being used.
I know there are from GL_LIGHT0 to GL_LIGHT7.
In my opinion GL_LIGHT0 features seems to be different from others.
Who can you explain GL_LIGHT0 is this?
...
Thank you!
Cheers,
YoungStone,
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=48576#48576
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org