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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bruno
Carneiro de Castro
Sent: Friday, July 25, 2008 7:40 AM
To: [email protected]
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
[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