Hi,

you have to replicate what you did for the camera decorators for the
viewports as well. So you need StereoBufferViewports, one for the left
eye with 

        svpleft->setLeftBuffer(true);
        svpleft->setRightBuffer(false);
        svpleft->setCamera(cameraDecoratorLeft);

and one for the right eye, with 

        svpright->setLeftBuffer(false);
        svpright->setRightBuffer(true);
       svpleft->setCamera(cameraDecoratorRight);

than add both viewports to the Window. 

Source/System/Window/testStereoDecor.cpp  has some examples for
reference.


kind regards
  gerrit


On Tue, 2014-11-25 at 15:48 +0100, Jörn Teuber wrote:
> Hello everybody,
> 
> I have a seemingly simple problem with OpenSG 1.8 (yes, I have to use 
> that version...) which I don't know how to solve:
> I want to use a zSpace Monitor to render in 3D, so I need quad buffered 
> stereo. No problem I thought, just use the StereoBufferedViewport with a 
> Camera with two ShearedStereoCameraDecorator. But it does give me any 
> 3D. I still only get a 2D version of my scene even though the monitor is 
> clearly in 3D mode. I can even disable one of the buffers of the 
> Viewport to get a nice flickering window. What did I miss here?
> 
> Now a snippet of the relevant code I use (the original got some calls to 
> the zSpace API, but I don't think they matter here):
> 
> initialisation:
> [...]
> 
>      m_pCamera = osg::PerspectiveCamera::create();
>      osg::beginEditCP(m_pCamera);
>          m_pCamera->setBeacon(m_pCamBeacon);
>          m_pCamera->setFov(osg::deg2rad(60));
>          m_pCamera->setNear(0.1);
>          m_pCamera->setFar(100);
>      osg::endEditCP(m_pCamera);
> 
>      osg::ShearedStereoCameraDecoratorPtr cameraDecoratorLeft, 
> cameraDecoratorRight;
> 
>          cameraDecoratorLeft = osg::ShearedStereoCameraDecorator::create();
>          osg::beginEditCP(cameraDecoratorLeft);
>              cameraDecoratorLeft->setLeftEye(true);
>              cameraDecoratorLeft->setEyeSeparation( fEyeSeperation );
>              cameraDecoratorLeft->setDecoratee(m_pCamera);
>              cameraDecoratorLeft->setZeroParallaxDistance( 
> fZeroParallaxDist );
>          osg::endEditCP(cameraDecoratorLeft);
> 
>          cameraDecoratorRight = osg::ShearedStereoCameraDecorator::create();
>          osg::beginEditCP(cameraDecoratorRight);
>              cameraDecoratorRight->setLeftEye(false);
>              cameraDecoratorRight->setEyeSeparation( fEyeSeperation );
>              cameraDecoratorRight->setDecoratee(m_pCamera);
>              cameraDecoratorRight->setZeroParallaxDistance( 
> fZeroParallaxDist );
>          osg::endEditCP(cameraDecoratorRight);
> 
>          m_pViewport = osg::StereoBufferViewport::create();
> 
>       osg::beginEditCP(m_pViewport);
>          m_pViewportLeft->setCamera( m_pCamera );
>          m_pViewportLeft->setBackground( background );
>          m_pViewportLeft->setRoot(pRoot);
>          m_pViewportLeft->setSize(0,0,1,1);
>      osg::endEditCP(m_pViewport);
> 
>      m_pWindow = osg::GLUTWindow::create();
>      osg::beginEditCP(m_pWindow);
>          m_pWindow->setId(winid);
>          m_pWindow->addPort(m_pViewport);
>          m_pWindow->setSize( m_iWindowWidth, m_iWindowHeight);
>          m_pWindow->init();
>      osg::endEditCP(m_pWindow);
> 
> 
> rendering: a simple
> void render( osg::RenderAction* pRenderAction )
> {
>      m_pWindow->render( pRenderAction );
> }
> 
> Thank you so much for any help with this!
> Best regards
> Jörn Teuber
> 
> ------------------------------------------------------------------------------
> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
> from Actuate! Instantly Supercharge Your Business Reports and Dashboards
> with Interactivity, Sharing, Native Excel Exports, App Integration & more
> Get technology previously reserved for billion-dollar corporations, FREE
> http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
> _______________________________________________
> Opensg-users mailing list
> Opensg-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensg-users

-- 

Gerrit Voß
盖瑞客
---------------------------------------------------
Fraunhofer IDM @ NTU
南洋理工大学, Nanyang Technological University, (NTU)
新加坡,      Singapore
--------------------------------------------------

If we communicate everything we ever think, speech 
just becomes static. And all of us become bores.

J. Clarkson



------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to