Hi,

On Monday 05 January 2009 20:03:55 Paul wrote:
> Good work Thomas. Any plan to release the code or an example ?

I'm not sure what our internal policy is about releasing the complete code. 
Anyway, we basically took the eqPly example and added 
rendering with a osgViewer::Viewer to it.

For this to work, the following needs to be done:
- in Channel::frameDraw, pass the frustum and the viewport of the channel to  
  the camera of the viewer.
- Set a osgViewer::GraphicsWindowEmbedded as the context of the camera so that 
  OSG doesn't try to create its own window.

That is all.
The relevant code is:

bool Channel::configInit( const uint32_t initID )
{
    if( !eq::Channel::configInit( initID ))
        return false;

    osg::ref_ptr<osg::Node> root = createSceneGraph().get();
    mViewer = new osgViewer::Viewer();
    mViewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
    mViewer->setSceneData(root.get());
    mContext = new osgViewer::GraphicsWindowEmbedded;

    return true;
}

void Channel::frameDraw( const uint32_t frameID )
{
    eq::Channel::frameDraw( frameID );
    mViewer->getCamera()->setGraphicsContext( mContext.get() ); 
    const vmml::Frustumf& channelfrustum = getFrustum();
    mViewer->getCamera()->setProjectionMatrixAsFrustum(
           channelfrustum.left, channelfrustum.right,
           channelfrustum.bottom, channelfrustum.top,
           channelfrustum.nearPlane, channelfrustum.farPlane );
    const eq::PixelViewport& channelviewport = channel->getPixelViewport();
    mViewer->getCamera()->setViewport( channelviewport.x,channelviewport.y,
                                       channelviewport.w,channelviewport.h ); 
    mViewer->frame();
}

Regards,
Thomas

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
eq-dev mailing list
[email protected]
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Reply via email to