[osg-users] Shadow in GraphicsWindowEmbedded

Robert Osfield robert.osfield at gmail.com
Wed Aug 15 00:46:38 PDT 2018


HI Cong,

In your code snippet you don't set Camera::setRead.WriteBuffer()
settings.  For a double buffer this will need to be GL_BACK.

Robert
On Wed, 15 Aug 2018 at 08:20, Cong Ye <sirian_ye at hotmail.com> wrote:
>
> 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
>
>
>
>
>
> _______________________________________________
> 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