Ah, thanks, that solved the problem.

However, there is now a new problem: is it possible to change this view
distance for everything, except the skybox (so that the skybox is always
rendered)? My skybox, currently, is on a Group, that is child of root.

On Tue, Dec 2, 2008 at 5:05 PM, Robert Osfield <[EMAIL PROTECTED]>wrote:

> HI Jefferson,
>
> The OSG by default doesn't enable the near and far planes for culling
> purposes, as doing so would require end users to accurately manage
> their near/far plane.
>
> To enable the near/far culling simple do:
>
>  viewer->getCamera()->setCullingMode(osg::CullSettings::VIEW_FRUSTUM_CULLING
> |
>
> osg::CullSettings::SMALL_FEATURE_CULLING);
>
> You may also want to disable the compute and near/far planes.
>
>
>  
> viewer->getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
>
> Robert.
>
> On Tue, Dec 2, 2008 at 7:48 PM, Jefferson Pinheiro
> <[EMAIL PROTECTED]> wrote:
> > For performance reasons, I want to render only that which is close to my
> > camera. I tried changing zNear and zFar, but they make absolutely no
> effect
> > (I tried values such as 100,200; 10,20; 0.000001;0.000002). However, for
> > instance, changing the FOV (which is 80 now), does changes the FOV. My
> world
> > scale is 1 unit = 1 cm. What might be wrong?
> >
> >     {
> >         viewer.setCameraManipulator(cm); //cm = class CamManipCarro :
> public
> > osgGA::MatrixManipulator (a custom camera manpulator)
> >
> >         osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
> > osg::GraphicsContext::Traits;
> >         traits->x = 0;
> >         traits->y = 0;
> >         traits->width = GetSystemMetrics(SM_CXSCREEN);
> >         traits->height = GetSystemMetrics(SM_CYSCREEN);
> >         traits->windowDecoration = false;
> >         traits->doubleBuffer = true;
> >         //traits->sharedContext = 0;
> >         osg::ref_ptr<osg::GraphicsContext> gc =
> > osg::GraphicsContext::createGraphicsContext(traits.get());
> >
> > // HERE !! Changing the last 2 parameters makes no effect. I wanted it
> would
> > render only that which is between 100 and 200 units from my camera.
> >         viewer.getCamera()->setProjectionMatrixAsPerspective(80,(double)
> > GetSystemMetrics(SM_CXSCREEN) / (double)
> > GetSystemMetrics(SM_CYSCREEN),100,200);
> >
> >
> >         viewer.getCamera()->setNearFarRatio(0.000002);
> >         viewer.getCamera()->setGraphicsContext(gc.get());
> >         viewer.getCamera()->setViewport(new osg::Viewport(0,0,
> > traits->width, traits->height));
> >         GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
> >         viewer.getCamera()->setDrawBuffer(buffer);
> >         viewer.getCamera()->setReadBuffer(buffer);
> >
> >         osg::Camera* hudCamera = createHUD();
> >         hudCamera->setGraphicsContext(gc.get());
> >         hudCamera->setViewport(0,0,traits->width, traits->height);
> >         viewer.addSlave(hudCamera, false);
> >
> >         viewer.setSceneData(root);
> >         viewer.realize();
> >         viewer.getCamera()->setUpdateCallback(new
> CameraUpdateCallback());
> >     }
> >
> >
> > --
> > Jefferson Pinheiro
> >
> > _______________________________________________
> > osg-users mailing list
> > osg-users@lists.openscenegraph.org
> >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> >
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Jefferson Pinheiro
(51) 9192 3535
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to