For creating a stereo-in-a-window canvas in GTK (with Python that is) I had
to step away from using setUpViewerAsEmbeddedInWindow, as this function
creates a new osgViewer::GraphicsWindowEmbedded with parameters
(x,y,width,height). This results in a "default" graphics context setup
without specific settings, e.g. stereo. I now sort of mimic
setUpViewerAsEmbeddedInWindow by making an osg::Traits instance, set the
traits->quadBufferStereo to true, and pass this to
osgViewer::GraphicsWindowEmbedded (which is already overloaded to accept a
Traits instance). This gives me a working stereo canvas. Hope this works for
you.

Gerwin

P.s. be sure that your graphics card supports QUAD_BUFFER stereo in a
(non-fullscreen) window on your OS (for example, you have a nVidia Quadro
card on linux)

On Mon, Aug 25, 2008 at 9:07 PM, Yanling Liu <[EMAIL PROTECTED]> wrote:

> Hi, I was trying to enable QUAD_BUFFER stereo in my OSG based application
> but failed. OSG reports error message saying "error reported in OpenGL after
> Renderbin:draw()".
>
> I am using osgViewer::setUpViewerAsEmbeddedInWindow() to use OSG with
> fox-toolkit:
>
> //parepare fox OpenGL canvas
> m_pGLVisual = new FXGLVisual(getApp(), VISUAL_DOUBLEBUFFER|VISUAL_BEST);
> m_pGLCanvas = new FXGLCanvas(pGLFrame, m_pGLVisual, this, ID_CANVAS,
> LAYOUT_FILL);
>
> //create osgViewer object and enable stereo
>     m_pGLCanvas->makeCurrent();
>
>     // create the view of the scene.
>     m_osgViewer = new osgViewer::Viewer;
>     m_osgGraphicsWindow =
> m_osgViewer->setUpViewerAsEmbeddedInWindow(0,0,4,3);
>     m_osgViewer->setCameraManipulator(new osgGA::TrackballManipulator);
>     m_osgViewer->addEventHandler(new osgViewer::StatsHandler);
>     m_osgViewer->getCamera()->setClearColor(osg::Vec4f(1.0f, 1.0f, 1.0f,
> 1.0f));
>
>     osg::DisplaySettings* pDS = new osg::DisplaySettings;
>     pDS->setStereo(true);
>     pDS->setStereoType(osg::DisplaySettings::QUAD_BUFFER);
>     m_osgViewer->setDisplaySettings(pDS);
>
>     m_osgViewer->realize();
>
>     m_osgGraphicsWindow->resized(m_pGLCanvas->getX(), m_pGLCanvas->getY(),
> m_pGLCanvas->getWidth(), m_pGLCanvas->getHeight());
>     m_osgGraphicsWindow->getEventQueue()->windowResize(
>     m_pGLCanvas->getX(), m_pGLCanvas->getY(), m_pGLCanvas->getWidth(),
> m_pGLCanvas->getHeight());
>
>     m_pGLCanvas->makeNonCurrent();
>
> Any help on this? Maybe this is not the correct way to osgViewer with
> stereo? Or should I use osgViewer in its own window in order to enable
> QUAD_BUFFER stereo? I can pass --stereo QUAD_BUFFER to the osgViewer
> application to enable stereo on my machine. So it must be something wrong in
> my code....:(
>
> Many thanks,
> Yanling
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to