Re: [osg-users] Retrieve MatrixTransform of a loaded model
Hi, Thank you for your help. It works well! lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30173#30173 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Calculate latitude, longitude, height with intersection point
Hi, I want to obtain the latitude, longitude and height when I click with the mouse. Here is my code : osgGA::GUIEventAdapter ea; osgUtil::LineSegmentIntersector::Intersections intersections; std::string gdlist=; float x = ea.getX(); float y = ea.getY(); osg::ref_ptr osgUtil::LineSegmentIntersector picker = new osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, x, y); osgUtil::IntersectionVisitor iv(picker.get()); view-getCamera()-accept(iv); if (picker-containsIntersections()) { intersections = picker-getIntersections(); for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin(); hitr != intersections.end(); ++hitr) { std::ostringstream os; if (!hitr-nodePath.empty() !(hitr-nodePath.back()-getName().empty())) { // the geodes are identified by name. osObject \hitr-nodePath.back()-getName()\std::endl; } else if (hitr-drawable.valid()) { osObject \hitr-drawable-className()\std::endl; } osg::CoordinateSystemNode* csn = new osg::CoordinateSystemNode; csn-setEllipsoidModel(new osg::EllipsoidModel()); csn-addChild(TerrainNode); oslocal coords vertex( hitr-getLocalIntersectPoint())std::endl; osworld coords vertex( hitr-getWorldIntersectPoint())std::endl; osg::Vec3 point = hitr-getWorldIntersectPoint(); double latitude; double longitude; double height; csn-getEllipsoidModel()-convertXYZToLatLongHeight(point.x(),point.y(),point.z(),latitude,longitude,height); latitude = osg::RadiansToDegrees(latitude); longitude = osg::RadiansToDegrees(longitude); oslat,long,height( latitude , longitude , height ) std::endl; gdlist += os.str(); } } This works well when I don't make a translation or rotation on the terrain. But when I make a translation for example : TerrainNode= osgDB::readNodeFile(geo.osg); osg::ref_ptrosg::Group group = new osg::Group; osg::ref_ptrosg::MatrixTransform mat = new osg::MatrixTransform; group-addChild(mat); mat-addChild(TerrainNode); osg::Matrix trans; trans.makeTranslate(osg::Vec3f(1000,5000,1500)); mat-preMult(trans); the values of latitude, longitude and height are false and it's normal. I would prefer to use local point hitr-getLocalIntersectPoint(), which does not change when I make a translation, to calculate the latitude, longitude and height but I don't how to do this. Can you help me? Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30174#30174 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] 3D objects that don't rescale
Can you make 3D objects that don't rescale in OSG ? To clarify : if you move the camera closer and further, they will still have the same size. Still, they need to rotate and translate according to the movement of the camera. An example of that is the OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT character size mode for text. Here the text always has the same font size, independent of how far you are from the text geode. What I would like to have is something similar for for example points, lines and boxes. Thank you! Kind regards, Benedikt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30175#30175 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to set new PAT position for every traversal run ?
Hi, I am trying to set new values for the position of my PAT node for every run of while(!viewer.done()) Code: while( !viewer.done() ) { osg::Vec3d positionVector; // fire off the cull and draw traversals of the scene. viewer.frame(); viewer.updateTraversal(); receiveSignal(gpsInstance, gpsLat, gpsLon); setBackhoe(gpsLat, gpsLon, mapNode, surface, objectPlacer, backhoe1PAT); return 0; } And in my function: Code: void setBackhoe(double gpsLat, double gpsLon, osgEarth::MapNode* mapNode, osg::Node *surface, osgEarthUtil::ObjectPlacer* objectPlacer, osg::PositionAttitudeTransform* backhoe1PAT //osg::Vec3d positionVector ) { osg::Matrixd positionMatrix1; objectPlacer-createPlacerMatrix(gpsLat, gpsLon, 131, positionMatrix1); static double latitude; static double longitude; static double height; //static double x, y; static double X1 = positionMatrix1.getTrans().x(); static double Y1 = positionMatrix1.getTrans().y(); static double Z1 = positionMatrix1.getTrans().z(); //get SpatialReferenceSystem SRS for terrain (i.e. map) and lat-long. const SpatialReference* terrain_srs = mapNode-getMap()-getProfile()-getSRS(); const SpatialReference* latlong_srs = terrain_srs-getGeographicSRS(); //convert from projected to lat-long: terrain_srs-transform(X1, Y1, latlong_srs, longitude, latitude ); //to go from lat-long to projected: latlong_srs-transform(longitude, latitude, terrain_srs, X1, Y1); //set backhoe 1 exactly over terrain: letting the callback do that work. //set the PAT value of backhoe1: backhoe1PAT-setPosition(osg::Vec3d(X1, Y1, 0.0)); return ; } The problem I'm having is the my PAT node resets to (0,0,0) as soon as the function is exited. But since I was passing in by pointer a PAT node which I created in my main(), I thought this would not happen. How can I keep the current position value in my PAT node till it is updated in the next run ? Been stuck on this for quite a while so was hoping to get some advise. Thanks. Best, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30176#30176 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Visual Studio 2010 3rd Party
Posting those binaries somewhere would be a fantastic help to me and others, it sounds like! Thanks!!! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30177#30177 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to set new PAT position for every traversal run ?
probably if you post the whole code someone might help you better. My advice is to use the updateCallback of the PAT node - you make sure then you are working on the right node. -Nick On Thu, Jul 22, 2010 at 2:41 PM, Sanat Talmaki sanat.sch...@gmail.comwrote: Hi, I am trying to set new values for the position of my PAT node for every run of while(!viewer.done()) Code: while( !viewer.done() ) { osg::Vec3d positionVector; // fire off the cull and draw traversals of the scene. viewer.frame(); viewer.updateTraversal(); receiveSignal(gpsInstance, gpsLat, gpsLon); setBackhoe(gpsLat, gpsLon, mapNode, surface, objectPlacer, backhoe1PAT); return 0; } And in my function: Code: void setBackhoe(double gpsLat, double gpsLon, osgEarth::MapNode* mapNode, osg::Node *surface, osgEarthUtil::ObjectPlacer* objectPlacer, osg::PositionAttitudeTransform* backhoe1PAT //osg::Vec3d positionVector ) { osg::Matrixd positionMatrix1; objectPlacer-createPlacerMatrix(gpsLat, gpsLon, 131, positionMatrix1); static double latitude; static double longitude; static double height; //static double x, y; static double X1 = positionMatrix1.getTrans().x(); static double Y1 = positionMatrix1.getTrans().y(); static double Z1 = positionMatrix1.getTrans().z(); //get SpatialReferenceSystem SRS for terrain (i.e. map) and lat-long. const SpatialReference* terrain_srs = mapNode-getMap()-getProfile()-getSRS(); const SpatialReference* latlong_srs = terrain_srs-getGeographicSRS(); //convert from projected to lat-long: terrain_srs-transform(X1, Y1, latlong_srs, longitude, latitude ); //to go from lat-long to projected: latlong_srs-transform(longitude, latitude, terrain_srs, X1, Y1); //set backhoe 1 exactly over terrain: letting the callback do that work. //set the PAT value of backhoe1: backhoe1PAT-setPosition(osg::Vec3d(X1, Y1, 0.0)); return ; } The problem I'm having is the my PAT node resets to (0,0,0) as soon as the function is exited. But since I was passing in by pointer a PAT node which I created in my main(), I thought this would not happen. How can I keep the current position value in my PAT node till it is updated in the next run ? Been stuck on this for quite a while so was hoping to get some advise. Thanks. Best, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30176#30176 ___ 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
Re: [osg-users] 3D objects that don't rescale
Yes. You can use osg::AutoTransform I think -Nick On Thu, Jul 22, 2010 at 2:09 PM, benedikt naessens benedikt.naess...@spaceapplications.com wrote: Can you make 3D objects that don't rescale in OSG ? To clarify : if you move the camera closer and further, they will still have the same size. Still, they need to rotate and translate according to the movement of the camera. An example of that is the OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT character size mode for text. Here the text always has the same font size, independent of how far you are from the text geode. What I would like to have is something similar for for example points, lines and boxes. Thank you! Kind regards, Benedikt -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30175#30175 ___ 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
Re: [osg-users] 3D objects that don't rescale
Thanks ! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30180#30180 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Headtracking
Hi folks I'm sitting here trying to set up a head tracking... I got an api that spits out a viewmatrix for the camera and now I have to get this matrix in the write place. I wrote an updateCallback for the Cameras (left/right) that looks like this. class updateCameraPosCallback : public osg::NodeCallback { virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { osg::Camera* cam = dynamic_castosg::Camera* (node); if(cam) { osg::Matrix mat(s-getMatrix().data()); cam-setViewMatrix( mat); } } }; I checked the matrix and it looks ok, but somhow the cameras don't move! Any tips?? Thank you! Cheers, Thomas -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30181#30181 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Headtracking
Hi, Maybe you already have a Matrix/Camera Manipulator that override your update callback ? -Fred - Thomas Klemmer klem...@uni-weimar.de a écrit : Hi folks I'm sitting here trying to set up a head tracking... I got an api that spits out a viewmatrix for the camera and now I have to get this matrix in the write place. I wrote an updateCallback for the Cameras (left/right) that looks like this. class updateCameraPosCallback : public osg::NodeCallback { virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { osg::Camera* cam = dynamic_castosg::Camera* (node); if(cam) { osg::Matrix mat(s-getMatrix().data()); cam-setViewMatrix( mat); } } }; I checked the matrix and it looks ok, but somhow the cameras don't move! Any tips?? Thank you! Cheers, Thomas -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30181#30181 ___ 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
[osg-users] intersection and threading problem
Hey all, I'm using osg 2.9.8 and trying to do intersection tests in a thread. The code is real straightforwards and works well when not threaded: Code: osg::ref_ptrosgUtil::LineSegmentIntersector intersector = new osgUtil::LineSegmentIntersector(start, end); osgUtil::IntersectionVisitor visitor(intersector); visitor.setLODSelectionMode(osgUtil::IntersectionVisitor::LODSelectionMode::USE_HIGHEST_LEVEL_OF_DETAIL ); osgEarthNode-accept(visitor); if(intersector-containsIntersections()) { osgUtil::LineSegmentIntersector::Intersections::const_iterator firstHit = intersector-getIntersections().begin(); worldIntersectionPosition = firstHit-getWorldIntersectPoint(); worldIntersectionNormal = firstHit-getWorldIntersectNormal(); return true; } Is this a known issue? -Markus -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30183#30183 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] intersection and threading problem
Hi Markus, I'm using osg 2.9.8 and trying to do intersection tests in a thread. The code is real straightforwards and works well when not threaded: [...] Is this a known issue? Err, you say what you want to do, that it works when not threaded, but not what happens when you try to do it in a thread. Do you get crashes? Do you get error messages? Do you get erroneous results? Without this info it's hard to help you out... I don't see why it wouldn't work /a priori/, unless your thread is running while some other part of your app is modifying the scene graph. That might invalidate iterators that the IntersectionVisitor is using or things like that, which might lead to crashes. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Making objects transparent without using textures at all
Hi, Examples that come with the OSG source code? Cheers, Dženan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30186#30186 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS 2010 and OSG v2.8.3?
Hi, I just compile-tested OSG 2.8.3 with VS2010, x64 target. It has build errors (full log attached). Furthermore, I cannot switch to VS2010 because Qt doesn't support it at the moment. Cheers, Dženan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30187#30187 Attachments: http://forum.openscenegraph.org//files/output_build_139.txt ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS 2010 and OSG v2.8.3?
From your log it looks like the only problem you are having, which I encountered as well, is the new C++/stl problem. You need to add: #include iterator to the header file NodeCallBack. This should get rid of most of the errors, but you may have to add the above include to other files as well. Say you build it again and get: 5GraphicsContext.cpp(680): error C2039: 'back_inserter' : is not a member of 'std' 5GraphicsContext.cpp(680): error C3861: 'back_inserter': identifier not found Then add #include iterator to GraphicsContext.cpp. Try just editing NodeCallBack's header because it needs to be there and I think it catches most of the other undeclared back_inserter calls. -K On Thu, 22 Jul 2010, D??enan Zuki? wrote: Hi, I just compile-tested OSG 2.8.3 with VS2010, x64 target. It has build errors (full log attached). Furthermore, I cannot switch to VS2010 because Qt doesn't support it at the moment. Cheers, Dženan Keith ParkinsU of R Center for Visual Science___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VS 2010 and OSG v2.8.3?
Hi, Thanks for the tips, they may come in handy once Qt 4.7 is out and I start migrating to VS2010, and new version of OSG which includes those includes is not published. Thank you! Cheers, Dženan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30189#30189 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Calculate latitude, longitude, height with intersection point
Hi, Can you help me please? I am blocked on my project. I just want to know how to obtain the latitude, longitude and height from the local coordinates of the point of intersection. Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30190#30190 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to set new PAT position for every traversal run ?
Hi Sanat, Have a look at the osganimation example. FYI, Viewer::frame() calls updateTraversal() for you, so you don't need to call it yourself. Robert. On Thu, Jul 22, 2010 at 11:41 AM, Sanat Talmaki sanat.sch...@gmail.com wrote: Hi, I am trying to set new values for the position of my PAT node for every run of while(!viewer.done()) Code: while( !viewer.done() ) { osg::Vec3d positionVector; // fire off the cull and draw traversals of the scene. viewer.frame(); viewer.updateTraversal(); receiveSignal(gpsInstance, gpsLat, gpsLon); setBackhoe(gpsLat, gpsLon, mapNode, surface, objectPlacer, backhoe1PAT); return 0; } And in my function: Code: void setBackhoe(double gpsLat, double gpsLon, osgEarth::MapNode* mapNode, osg::Node *surface, osgEarthUtil::ObjectPlacer* objectPlacer, osg::PositionAttitudeTransform* backhoe1PAT //osg::Vec3d positionVector ) { osg::Matrixd positionMatrix1; objectPlacer-createPlacerMatrix(gpsLat, gpsLon, 131, positionMatrix1); static double latitude; static double longitude; static double height; //static double x, y; static double X1 = positionMatrix1.getTrans().x(); static double Y1 = positionMatrix1.getTrans().y(); static double Z1 = positionMatrix1.getTrans().z(); //get SpatialReferenceSystem SRS for terrain (i.e. map) and lat-long. const SpatialReference* terrain_srs = mapNode-getMap()-getProfile()-getSRS(); const SpatialReference* latlong_srs = terrain_srs-getGeographicSRS(); //convert from projected to lat-long: terrain_srs-transform(X1, Y1, latlong_srs, longitude, latitude ); //to go from lat-long to projected: latlong_srs-transform(longitude, latitude, terrain_srs, X1, Y1); //set backhoe 1 exactly over terrain: letting the callback do that work. //set the PAT value of backhoe1: backhoe1PAT-setPosition(osg::Vec3d(X1, Y1, 0.0)); return ; } The problem I'm having is the my PAT node resets to (0,0,0) as soon as the function is exited. But since I was passing in by pointer a PAT node which I created in my main(), I thought this would not happen. How can I keep the current position value in my PAT node till it is updated in the next run ? Been stuck on this for quite a while so was hoping to get some advise. Thanks. Best, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30176#30176 ___ 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
Re: [osg-users] Calculate latitude, longitude, height with intersection point
Hi Lucie, The CoordinateSystemNode can map between Earth Center Earth Fixed coordinate frame and lats/longs. If you have local coordinates then you need to accumulate the model transforms to move the local coord into world coords. The LineSegmentInersector will accumulate the transforms for you and provide you LineSegmentInersector::Intersection::getWorldIntersectPoint() convinience method which does the transform on the intersection point for you. Robert. On Thu, Jul 22, 2010 at 4:44 PM, lucie lemonnier lucielemonn...@hotmail.fr wrote: Hi, Can you help me please? I am blocked on my project. I just want to know how to obtain the latitude, longitude and height from the local coordinates of the point of intersection. Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30190#30190 ___ 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
Re: [osg-users] Visual Studio 2010 3rd Party
Hi, Way back when I built a package of 3rdParty binaries for my OSG 2.4 installer w/ VS8, I tried to capture all the cookbook steps in scripts. All that info is available at http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/3rdParty/ With general updating of version info, those scripts will hopefully be a big step fwd. My entire build process for OSG on Windows, including binary installer generation using Inno Setup, is also in that repo. cheers -- mew -- Mike Weiblen -- Black Hawk, Colorado USA -- http://mew.cx/ On Thu, Jul 15, 2010 at 9:01 PM, Jason Alexander phishja...@yahoo.com wrote: Hi, I have successfully built OSG with Visual Studio 2010, but my application is still having issues with std libraries when I link in OSG. I believe I have narrowed the problem down to not having all of the 3rd party libraries built with Visual Studio 2010. Can anyone out there save me some serious time and provide 3rd party libraries built with VS10? Thank you! Cheers, Jason -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30055#30055 ___ 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
Re: [osg-users] Headtracking
Hi, osgVRPN uses VRPN as the interface to various VR devices, including trackers. You could use that software stack, or you can extract the OSG matrix manipulation code from http://osgtoy.svn.sourceforge.net/viewvc/osgtoy/osgvrpn/ cheers -- mew -- Mike Weiblen -- Black Hawk, Colorado USA -- http://mew.cx/ On Thu, Jul 22, 2010 at 7:01 AM, Thomas Klemmer klem...@uni-weimar.de wrote: Hi folks I'm sitting here trying to set up a head tracking... I got an api that spits out a viewmatrix for the camera and now I have to get this matrix in the write place. I wrote an updateCallback for the Cameras (left/right) that looks like this. class updateCameraPosCallback : public osg::NodeCallback { virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { osg::Camera* cam = dynamic_castosg::Camera* (node); if(cam) { osg::Matrix mat(s-getMatrix().data()); cam-setViewMatrix( mat); } } }; I checked the matrix and it looks ok, but somhow the cameras don't move! Any tips?? Thank you! Cheers, Thomas -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30181#30181 ___ 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
Re: [osg-users] Calculate latitude, longitude, height with intersection point
Hi, I also have wrong values when I use the world coordinates of the intersection when I make a translation. It's normal? Thank you! Cheers, lucie -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30197#30197 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to set new PAT position for every traversal run ?
Hi Robert, I will definitely take a look at the osganimate example. But this is a question I asked in the post above: If I declare a PAT node in my main(), is the only way to access and modify it through update callbacks ? The reason why I'm asking this is that tough I'm passing the PAT node by pointer, it gets a value of (0,0,0) when I check its value in the function arguments in bold below: called from main() while loop:- Code: setBackhoe(gpsLat, gpsLon, mapNode, surface, objectPlacer, backhoe1PAT); and observed the value of the arguments while debugging: Code: void setBackhoe(double gpsLat, double gpsLon, osgEarth::MapNode* mapNode, osg::Node *surface, osgEarthUtil::ObjectPlacer* objectPlacer, [b]osg::PositionAttitudeTransform* backhoe1PAT[/b] //osg::Vec3d positionVector ) { } Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30199#30199 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG world coordinates to 2D screen coordinates, reverse picking
Hi, I'm using OSG as part of a VR software package and I'm trying to implement picking with a 6DOF tracking system. I'm having trouble finding a way to convert the position of my tracking object (right now just a sphere) from its world coordinates to screen coordinates so I can use the xy coordinates to pick with. I'm porting my environment over from a normal monitor setup (where I can use a mouse for picking and already have all the code written) to a 3 sided cave setup where a mouse does not work. Im thinking of a hacky way to do it that I think would work if I knew how osg normalized mouse coordinates with osg::GUIEventAdapter::getXnormalized(), but I cannot for the life of me find the code for that function. If anyone knows of a method to convert world coordinates back to screen coordinates without having to totally reimplement my picking system, that would be great. If anyone can point me to the code for getXnormalized or the method used (I've found some - but they don't lead to the exact same result), that would be great as well. Thanks in advance! I posted this to the forum, but after a couple hours, my post hasn't even been approved yet (my first OSG post), so I figured I'd give the mailing list a try. Luke ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] ANN: OSGUIsh updated (GUI-like events for OSG nodes)
Hello, I've updated my old OSGUIsh library, so that it works with newer versions of OSG. This small library allows to register functions that get called when GUI-like events (mouse click, mouse move, key down...) happen on a specific OSG node. It can be used more or less like this: // First you define a callback void HandleClick(OSGUIsh::HandlerParams params) { std::cout Click on node ' params.node '!\n; } // Later, you connect the events to the callbacks osgViewer::Viewer viewer; osg::ref_ptrOSGUIsh::EventHandler guishEH( new OSGUIsh::EventHandler()); viewer.addEventHandler(guishEH); osg::ref_ptrosg::Node loadedModel = osgDB::readNodeFile(Some3DModel.obj); guishEH-addNode(loadedModel); guishEH-getSignal(loadedModel, Click)-connect(HandleClick); I don't think it is currently good enough for production use, but I guess it is a lot better than starting from scratch :-) It can be downloaded from here: http://www.stackedboxes.org/~lmb/osguish/ Cheers, LMB ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Making objects transparent without using texturesat all
I can think of at least 3 other options Use Alpha value on vertex color attributes Use Alpha value on a Material being applies (See the OSG example in the source on how to use vertex colors and materials And the other option would be to set the Alpha in shaders Gordon Tomlinson Product Manager 3d Technology Project Wyvern Overwatch® An Operating Unit of Textron Systems __ “WARNING: Documents that can be viewed, printed or retrieved from this E-Mail may contain technical data whose export is restricted by the Arms Export Control Act (Title 22, U.S.C., Sec 2751, et seq,) or the Export Administration Act of 1979, as amended, Title 50, U.S.C., App. 2401 et seq. and which may not be exported, released or disclosed to non-U.S. persons (i.e. persons who are not U.S. citizens or lawful permanent residents [“green card” holders]) inside or outside the United States, without first obtaining an export license. Violations of these export laws are subject to severe civil, criminal and administrative penalties.” -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Dženan Zuki Sent: Thursday, July 22, 2010 10:16 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] Making objects transparent without using texturesat all Hi, Examples that come with the OSG source code? Cheers, Dženan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30186#30186 ___ 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
Re: [osg-users] How to set new PAT position for every traversal run ?
Hi Nick, I followed your advice and set up an update callback. But I still can't seem to get rid of the problem that I was facing (i.e. positions getting set to (0,0,0) during callback traversal. I thought it might help if I attach the code for my callback functions instead of copying it here. In my main(), I attach the callback as follows: Code: //attach callback functions to backhoe PATs: backhoe1PAT-setUpdateCallback(new BackhoeUpdatePositionCallback( surface, mapNode, objectPlacer)); I'm hoping to understand why my callback is not setting the object at the right location. Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30204#30204 Attachments: http://forum.openscenegraph.org//files/backhoeupdatepositioncallback_181.h http://forum.openscenegraph.org//files/backhoeupdatepositioncallback_527.cpp ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to set new PAT position for every traversal run ?
Hi Sanat, There's so much there, including functions that I have no idea what they do, that it'll be hard to figure out. There is definitely some unnecessary bits that make it even harder for people who aren't you to figure out what is going on - for example, Code: backhoeGroundPosition = backhoePosition-getPosition(); backhoeGroundPosition = getCurrentPosition(backhoeGroundPosition); It appears that the argument to getCurrentPosition is never used within the function, so the first call (backhoePosition-getPosition(); ) is pointless. Not necessarily a killer problem, but the more tangled your code is, the harder it is for both you and us to figure anything out. Regardless... have you tried printing the results of various computations/calls to the screen? I'm thinking for example the value of the Vec3 returned by getCurrentPosition. Debugging messages that you add to your own code are invaluable in determining how things are working - you'll get much further that way than we will by looking at the code. If backhoeGroundPosition is always (0,0,0) after your function, that's a very different problem than if that value is changing but your model always appears in the same place on the terrain. Cheers, Tom -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30205#30205 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] ANN: OSGUIsh updated (GUI-like events for OSG nodes)
Hi LMB, Thanks for your intresting project! I'll take a look on it at weekend :) Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30206#30206 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org