[osg-users] Moving from Producer to osgViewer

Joseanibal Colon Ramos jcolon at email.arc.nasa.gov
Fri Jul 25 11:47:15 PDT 2008


Take a look at this:

http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/classes.html

It will help you find the proper function name changes (or similar
functions) for the new classes you will be using.

For instance:
osgProducer::Viewer* viewer_obj; ->
         ref_ptr<osgViewer::Viewer> viewer_obj; //re_ptr's are safer than
pointers alone. instead of dereferencing you do: viewer_obj.get()

Producer::Camera *camera_obj;  ->
         osg::Camera camera_obj;

and so on. Most of the things stay the same. Good luck.

-J




On Fri, July 25, 2008 5:20 am, Gordon Tomlinson wrote:
> Have you tried  ?
>
> It took us not more than a couple days to move away form producer in our
> apps
>
> Some things a little different and you pick up those up quickly when you
> convert
>
>
>
> -----Original Message-----
> From: osg-users-bounces at lists.openscenegraph.org
> [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Bruno
> Carneiro de Castro
> Sent: Friday, July 25, 2008 7:40 AM
> To: osg-users at lists.openscenegraph.org
> Subject: [osg-users] Moving from Producer to osgViewer
>
> Hi all
>
> I'm moving an app from Producer to osgViewer and have doubts about the
> equivalence between some Producer methods vs. osgViewer methods.
>
> May you help me, indicating the methods more suitable to change in the
> Producer code fragment below, in order to get it working under osgViewer?
>
> Thanks,
> Bruno
>
> -----------------------------
>
> //variables (just to contextualize)
>
> osgProducer::Viewer* viewer_obj;
>
> Producer::Camera *camera_obj;
>
> int x, y, width, height;
>
> double d_left, d_right, d_bottom, d_top, d_nearClip, d_farClip, d_xshear,
> d_yshear;
>
> float f_near, f_far, f_hfov, f_vfov;
>
> osg::Matrix matrix;
>
> osg::Matrixd matrixd;
>
> std::string name = "My Camera";
>
> osg::Group* hud;
>
> //methods that need conversion
>
> viewer_obj->getGlobalStateSet()->setMode( GL_FOG,
> osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON );
>
> camera_obj->getLensParams(d_left, d_right, d_bottom, d_top, d_nearClip,
> d_farClip, d_xshear, d_yshear);
>
> camera_obj->setLensFrustum( d_left, d_right, d_bottom, d_top, d_near,
> d_far,
> d_xshear, d_yshear );
>
> viewer_obj->getCameraConfig()->addCamera( name, camera_obj );
>
> camera_obj->setProjectionRectangle ( x, y, width, height );
>
> camera_obj->setLensAutoAspect(true);
>
> camera_obj->setLensPerspective( f_hfov, f_vfov, f_near, f_far );
>
> camera_obj = viewer_obj->getCameraConfig()-> findCamera( name.c_str() );
>
> camera_obj->setOffset( matrix.ptr() );
>
> viewer_obj->setSceneDecorator( hud );
>
> viewer_obj->setViewByMatrix( Producer::Matrix( matrixd.ptr() ) );
>
> viewer_obj->update();
>
> camera_obj->frame( false );
>
> osgDB::Registry::instance()->getOrCreateDatabasePager()-
>>setUseFrameBlock(true);
>
> for(SceneHandlerList::iterator itr = viewer_obj->_shvec.begin(); itr !=
> viewer_obj->_shvec.end(); ++itr) {
>     osgDB::Registry::instance()->getOrCreateDatabasePager()->
>     setCompileGLObjectsForContextID(
>     (*itr)->getSceneView()->getState()->getContextID(), false ); }
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>





More information about the osg-users mailing list