[osg-users] Shadow in GraphicsWindowEmbedded
Cong Ye
sirian_ye at hotmail.com
Tue Aug 14 23:55:31 PDT 2018
Hi,
I am recently encountered an interesting problem. I am trying to add shadow to a scene embedded in osgViewer::GraphicsWindowEmbedded. Most of shadow algorithms are working fine if i use osg::Viewer only. However, if I use them in GraphicsWindowEmbedded, nothing will be displayed.
The setting code would be:
_mGraphicsWindow = new osgViewer::GraphicsWindowEmbedded( this->x(), this->y(),
this->width(), this->height() );
osg::Camera* camera = new osg::Camera;
camera->setViewport( 0, 0, this->width(), this->height() );
camera->setClearColor( osg::Vec4( 0.9f, 0.9f, 1.f, 1.f ) );
float aspectRatio = static_cast<float>( this->width()) / static_cast<float>( this->height() );
camera->setProjectionMatrixAsPerspective( 30.f, aspectRatio, 1.f, 1000.f );
camera->setGraphicsContext( _mGraphicsWindow );
If i override the shadow and assign the graphiccontext to the shadow camera, the scene can be rendered, but all in black.
Thank you for any help!
Cheers,
Cong
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74522#74522
More information about the osg-users
mailing list