David, you'd better follow Robert's advice and get rid of that overly complex code. Why reinventing the wheel? If you want to do full screen stereo, just create a osgViewer::Viewer object. Then you can easily switch to stereo mode into your program or using environment variables (OSG_STEREO=ON, OSG_STEREO_MODE=stereo mode you want, etc)
Regards, Alberto El Martes 23 Junio 2009ES 14:11:48 [email protected] escribió: > Robert Osfield Thanks for helping me. > > can tell me if this translation is correct: > > OSG 1.2 > > Producer::RenderSurface *pRS = NULL; > Producer::ref_ptr<Producer::CameraConfig> pCamCfg = new > Producer::CameraConfig(); > for (unsigned int i=0;i<getNumViews();i++) > { > Producer::ref_ptr<Producer::Camera> pRightCamera = new > Producer::Camera(); > Producer::ref_ptr<Producer::Camera> pLeftCamera = new > Producer::Camera(); > > pRightCamera->setShareLens(false); > pRightCamera->setLensAutoAspect(false); > > std::stringstream nombre; > nombre<<"RightCamera"<<i; > pCamCfg->addCamera(nombre.str(),pRightCamera.get()); > > if (pRS==NULL) > pRS=pRightCamera->getRenderSurface(); > else > pRightCamera->setRenderSurface(pRS); > > pRS->useCursor(true); > pRS->setCustomFullScreenRectangle( > GetSystemMetrics(SM_XVIRTUALSCREEN), > GetSystemMetrics(SM_YVIRTUALSCREEN), > GetSystemMetrics(SM_CXVIRTUALSCREEN), > GetSystemMetrics(SM_CYVIRTUALSCREEN) > ); > > std::cout <<"Resolución de Escritorio: " > << GetSystemMetrics(SM_XVIRTUALSCREEN) << "," > << GetSystemMetrics(SM_YVIRTUALSCREEN) << "," > << GetSystemMetrics(SM_CXVIRTUALSCREEN) << "," > << GetSystemMetrics(SM_CYVIRTUALSCREEN); > pLeftCamera->setShareLens(false); > pLeftCamera->setLensAutoAspect(false); > pLeftCamera->setRenderSurface(pRS); > nombre<<"LeftCamera"<<i; > pCamCfg->addCamera(nombre.str(),pLeftCamera.get()); > > } > m_pViewer = new osgProducer::Viewer(pCamCfg.get()); > > ############################## > OSG 2.8 > ############################## > for (unsigned int i=0; i < getNumViews(); i++) > { > osg::ref_ptr<osg::GraphicsContext::Traits> traits = new > osg::GraphicsContext::Traits; > traits->x = GetSystemMetrics(SM_XVIRTUALSCREEN); > traits->y = GetSystemMetrics(SM_YVIRTUALSCREEN); > traits->width = GetSystemMetrics(SM_CXVIRTUALSCREEN); > traits->height = GetSystemMetrics(SM_CYVIRTUALSCREEN); > traits->windowDecoration = true; > traits->doubleBuffer = true; > traits->sharedContext = 0; > > osg::ref_ptr<osg::GraphicsContext> gc = > osg::GraphicsContext::createGraphicsContext(traits.get()); > > osg::ref_ptr<osg::Camera> pRightCamera = new osg::Camera; > osg::ref_ptr<osg::Camera> pLeftCamera = new osg::Camera; > > // Camara Der > pRightCamera->setGraphicsContext(gc.get()); > pRightCamera->setViewport(new osg::Viewport(0,0, traits->width, > traits->height)); > GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT; > pRightCamera->setDrawBuffer(buffer); > pRightCamera->setReadBuffer(buffer); > > m_pViewer->addSlave(pRightCamera.get(), > osg::Matrixd::translate(-1.0,0.0,0.0), osg::Matrixd()); > > //Camara Izq > pLeftCamera->setGraphicsContext(gc.get()); > pLeftCamera->setViewport(new osg::Viewport(0,0, traits->width, > traits->height)); > pLeftCamera->setDrawBuffer(buffer); > pLeftCamera->setReadBuffer(buffer); > m_pViewer->addSlave(pLeftCamera.get(), > osg::Matrixd::translate(-1.0,0.0,0.0), osg::Matrixd()); > } > > I get an execution error. > > Error: > Unhandled exception at 0xXXXXXX (osg55-osgd.dll) in XXXXXX.exe: > 0xC0000005: Access violation reading location 0x0000006c. > > Sorry my english. I am Spanish > -- > ------------------------------------------------------ > David Tapia > [email protected] > > > _______________________________________________ > 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

