Hi,
see below...
On 31/05/10 22:58, José Carlos Ruiz wrote:
Hi community!
I'm José Carlos. Since a few months I'm using OSG, but now I've a problem
trying to render a scene with a orthogonal view.
There are not problems with Perspective or Frustrum, but when I change to
ortogonal the scene doesn't shows nothing.
Here's the code!
//Loading the model
osg::ref_ptr<osg::Node> scene =
osgDB::readNodeFile("t72-tank\\t72-tank_des.flt");
osg::ref_ptr<osg::PositionAttitudeTransform> posicion = new
osg::PositionAttitudeTransform;
posicion->addChild(scene);
posicion->setPosition(osg::Vec3d(0.0,0.0,10.0));
posicion->setScale(osg::Vec3d(0.025,0.025,0.025));
osg::ref_ptr<osg::Group> group =
dynamic_cast<osg::Group*>(posicion.get());
if (!group)
{
group = new osg::Group;
group->addChild(scene.get());
}
Don't you want to add "posicion" to group here?
//Modelview and projection config.
osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
viewer->getCamera()->setViewport(new osg::Viewport(0.0, 0.0, 1920.0,
1080.0));
//viewer->getCamera()->setProjectionMatrixAsFrustum(-2.0,2.0,-2.0,2.0,5.0,50.0);
viewer->getCamera()->setProjectionMatrixAsOrtho(-2.0,2.0,-2.0,2.0,5.0,
50.0);
Try with some larger values than 2 if your model is bigger.
rgds
jp
viewer->getCamera()->setReferenceFrame(osg::Transform::RELATIVE_RF);
viewer->getCamera()->setViewMatrix(osg::Matrix::identity());
viewer->getCamera()->setViewMatrixAsLookAt(osg::Vec3d(0, 0, -10),
osg::Vec3d(0, 0, 10), osg::Vec3d(0,-1,0));
viewer->setSceneData(group.get());
viewer->addEventHandler(new PickHandler(updateText.get()));
viewer->realize();
while (!viewer->done()){
viewer->frame();
}
return 0;
Thanks in advance! Regards!
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=28387#28387
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org