Re: [osg-users] Understanding how osg::switch node works?
Hi dewey, The problem was that I had more than a single switch node and only one attribute was getting turned on/off which I only noticed after zooming into my scene. I corrected it by writing a visitor accumulating all the switches and turning each of them on/off. Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42888#42888 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Understanding how osg::switch node works?
Hi, I am trying to use an osg::Switch node in my scene to toggle on/off certain sub-graphs. the way I have my subgraph set up is: I have a geode (textGeode) which is placed under a switch node and the switch is then place below an LOD node. Code: annotationsSwitch-addChild(textGeode, true); annotationsLod-addChild(annotationsSwitch, 0, 700); When I try using the following to turn the switch On/Off, my geometry is still visible. Code: setChildValue( getSearchedNode(QString(textGeode)), false); OR Code: setAllChildrenOff () I was under the impression that turning the geode off would ensure that the geometry placed below the geode would also be off. Do I need to use node masks to achieve this? Thanks! Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42845#42845 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Strange error with opening osg, osgt, osgb type files - ive files work ok.
Hi Wang, Sorry for my late response. I was away for sometime. Your catch was perfect. It was erroneous data that was causing it. I made the necessary changes to the source data and it works for the osg formats as well. Thanks for your clear explanation of why it was not working for osg with the faulty matrices - it helped me track down the problem better. Thanks! Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42541#42541 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Strange error with opening osg, osgt, osgb type files - ive files work ok.
Hi, I am creating a 3d geometry model and saving it out to osg, osgb, osgt and ive formats. I tried to view the saved files in osgviewer and strangely, I can only view the ive file. The others (osg, osgb, osgt) are not visible in viewer as only the background clear_color is seen. As can be seen in the attached osg file, the geometry and all the children seem to be saved correctly. I set OSG_NOTIFY_LEVEL to Debug and the output obtained is attached (too long to paste here) The writeNodeFile(..) returns true for all 4 file types. The readNodeFile(..) returns a valid pointer to the node that I double checked with displaying numChildren. Code: if(osgDB::writeNodeFile(*cylinderGroupNode.get(), pipeNameToSave + .osgb)) { std::cout written out osgb\n; } if(osgDB::writeNodeFile(*cylinderGroupNode.get(), pipeNameToSave + .osgt)) { std::cout written out osgt\n; } if(osgDB::writeNodeFile(*cylinderGroupNode.get(), pipeNameToSave + .osg)) { std::cout written out osg\n; } if(osgDB::writeNodeFile(*cylinderGroupNode.get(), pipeNameToSave + .ive)) { std::cout written out ive\n; } Alternately, I created a test scene graph by loading the cow.osg, cessna etc and saved the resultant as a .osgt, .osgb and osgviewer is able to open this. Not sure what I'm missing in this particular problem. Using 0sg 3.0.1 (built from source), VisualStudio 2008, Win 7 32 bit. Thank you Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42339#42339 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Strange error with opening osg, osgt, osgb type files - ive files work ok.
Hi Wang, Sure, I'm attaching the files with this post. I was having trouble attaching them in the morning, guess they didn't get attached after all. Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42352#42352 Attachments: http://forum.openscenegraph.org//files/filetype_osgt_osgviewer_output_276.txt http://forum.openscenegraph.org//files/test_model_147.osg ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Strange error with opening osg, osgt, osgb type files - ive files work ok.
Hi Wang, The large translation values are intended as they are UTM coordinate values which can get pretty large. I'm not sure whether these are reasonable in your application or there is something wrong while saving to osg files. But these will cause the bound of the entire graph too large or invalid and then the default manipulator will not be able to find a suitable place for navigating. Is it possible for you to upload the correct ive file, too? But wouldn't the incorrect matrices also cause the same effect in the ive file i.e. osgviewer not able to apply the manipulator? I am using the exact same scene graph to output to both ive and osg The ive file that loads correctly in osgviewer is attached. What confuses me is why native osg does not seem to work while the ive format does? Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42357#42357 Attachments: http://forum.openscenegraph.org//files/test_110.ive ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I get the vertices of an .obj or how can I draw a geometry in OSG with a vertices array?
Hi Jose, If you choose to go the NodeVisitor route, depending on how your model(s) are built up in your graph - keep in mind you will need to collect the Transforms along the graph and apply them to the geometry below or get the world coordinates and transform the geometries accordingly. Thanks, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42358#42358 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I get the vertices of an .obj or how can I draw a geometry in OSG with a vertices array?
I just remembered that TriangleFunctor is also useful for this task, in case you haven't seen that already. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42359#42359 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Picking ShapeDrawables in osg
Hi Hartmut, I would take a look at the osgpick example. It covers a lot of the stuff you might be interested in. Thanks, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42360#42360 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Effect of rotation transforms on Bounding Spheres [using osgWorks for Bounding Spheres geometry]
I was able to figure out a couple of mistakes that I had in my code, thanks to Paul Martz. Attached is the a very simple example program I made to test/understand the bounding box and sphere creation sequence. Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42201#42201 Attachments: http://forum.openscenegraph.org//files/boundingboxboundingsphereexample_122.cpp ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How To: QTreeWidget with multiple nodes of same name in scenegraph
Hi, I am trying to create a QTreeWidget to represent the scene graph in a hierarchical tree view. I used the thread http://forum.openscenegraph.org/viewtopic.php?t=4486 as a starting point. The code used to create the tree nodes is: Code: void BuildTreeNodeVisitor::CreateSubTree(osg::NodePath list) { QTreeWidgetItem* subTree = _tree-topLevelItem(0); for(osg::NodePath::iterator pitr=list.begin(); pitr!=list.end(); ++pitr) //iterate over the entire nodePath from the node visitor iterator { std::string name = (*pitr)-getName(); bool find =false; if (!subTree) //if no item is present at the top of the tree //set the top most QTreeItem as the first element pointed to by pitr { QTreeWidgetItem *added = new QTreeWidgetItem(); //added-setText(0, QString(name.c_str()) ); added-setText(0, QString::fromLocal8Bit(SCENEGRAPH:)); _tree-addTopLevelItem (added); subTree = _tree-topLevelItem(0); } //loop through tree to check if name exists in tree for (int i = 0; i subTree-childCount(); i++) { if (subTree-child(i)-text(0)==QString::fromStdString(name)) //name already exists i.e. node already exists, do not add duplicate { find = true; subTree = subTree-child(i); break; } } if (!find) //node not found in the node path, create new item and add to tree { QTreeWidgetItem *added = new QTreeWidgetItem(); added-setText(0, QString::fromLocal8Bit (name.c_str())); subTree-addChild (added); } } return; } This works fine until the scene graph has more than 1 node with the same name. If I load two cow.osg nodes, the tree (as expected) shows only one. To work around I tried to set userData by setting it to false for every newly loaded node and then setting it to true when the node got added to tree. However, this has its own problems as the nodes (Geodes) lying underneath the loaded osg::ref_ptrOsg::Node do not have the userData set. Which makes this rather clumsy: Code: void BuildTreeNodeVisitor::CreateSubTree(osg::NodePath list) { QTreeWidgetItem* subTree = _tree-topLevelItem(0); for(osg::NodePath::iterator pitr=list.begin(); pitr!=list.end(); ++pitr) //iterate over the entire nodePath from the node visitor iterator { std::string name = (*pitr)-getName(); bool find = false; bool addedToTree; if(dynamic_castNodeAddedToTreeUserData*((*pitr)-getUserData()) == NULL) { (*pitr)-setUserData(new NodeAddedToTreeUserData(false)); addedToTree = false; } else { addedToTree = dynamic_castNodeAddedToTreeUserData* ((*pitr)-getUserData())-addedToTree; } int currentChildIndex; for (currentChildIndex = 0; currentChildIndex subTree-childCount(); currentChildIndex++) { if (subTree-child(currentChildIndex)-text(0)==QString::fromStdString(name)) //name already exists i.e. node already exists, do not add duplicate { if(addedToTree == true) { find = true; subTree = subTree-child(currentChildIndex); break; } } } if (!find) //node not found in the node path, create new item and add to tree { QTreeWidgetItem *added = new QTreeWidgetItem(); added-setText(0, QString::fromLocal8Bit (name.c_str())); subTree-addChild (added); (*pitr)-setUserData(new NodeAddedToTreeUserData(true)); } //check for geodes that do not have user data set and if not added to the tree if(find dynamic_castNodeAddedToTreeUserData*((*pitr)-getUserData()) == NULL) { QTreeWidgetItem *added = new QTreeWidgetItem(); added-setText(0, QString::fromLocal8Bit (name.c_str())); subTree-parent()-addChild(added); (*pitr)-setUserData(new NodeAddedToTreeUserData(true)); } } return; } I was having trouble figuring out the best way to solve this issue of creating a QTreeWidget that can represent any scene graph even having multiple nodes with same names. Any suggestions would be most welcome Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42169#42169 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Effect of rotation transforms on Bounding Spheres
Hi, I am trying to use the excellent application from osgworks - osgwbvv to draw bounding spheres around any particular selected node in the scene graph. The function used to draw the bounding sphere is below: Code: void OsgViewerWindow::drawBoundingSphere(osg::ref_ptrosg::Node node) { osg::MatrixList matrixList = node-getWorldMatrices(); osg::ref_ptrosg::MatrixTransform boundingBoxMt = new osg::MatrixTransform(); osg::ref_ptrosg::Geode boundingBoxGeode = new osg::Geode(); osg::StateSet* ss = boundingBoxGeode-getOrCreateStateSet(); ss-setAttributeAndModes( new osg::PolygonMode( osg::PolygonMode::FRONT_AND_BACK, osg::PolygonMode::LINE ) ); ss-setMode( GL_LIGHTING, osg::StateAttribute::OFF ); const osg::BoundingSphere bs( node-getBound() ); boundingBoxMt-postMult(osg::Matrix::rotate(matrixList[0].getRotate())* osg::Matrix::translate(bs._center + matrixList[0].getTrans()) ); //add drawable to the geode boundingBoxGeode-addDrawable( osgwTools::makeGeodesicSphere( bs._radius, 1 ) ); //add geode under Mt boundingBoxMt-addChild(boundingBoxGeode); //get the parent matrix transform of the node and add bounding sphere to it node-getParent(0)-addChild(boundingBoxGeode); return; } While this works fine when there are translations applied to the MatrixTransforms above the nodes, the bounding spheres do not enclose the geometry when rotations are added to the mix. Actually, rendering the bounding sphere clearly showed that something was wrong. I tried following some of the threads as there was some mention of rotations in transforms leading to incorrect results. I thought I was doing ok but haven't had much success. Hence I wanted to ask what is the correct approach to get the bounding sphere for a particular node which may have rotations in addition to translation and scale. Thanks Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42174#42174 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How To: QTreeWidget with multiple nodes of same name in scenegraph
Hi Martin, I'll take a look at the MVC in Qt. Expanding on the last point you made, the fact that most tree structures such as QTreeWidget, etc seem to have the option for only one parent node, is that an enforced limitation on a scene graph being built - for example, someone would have to load different tires for 2 cars even if they may end up using the same just to allow the tree view to be a faithful representation of the scene graph ? Thanks, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42175#42175 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Is it safe/ok to use only PositionAttitudeTransforms instead of MatrixTransforms
Hi Alji, I did end up using MatrixTransforms and the one place where I found them easier to use (i.e. more logical to achieve the functionality) was where I had to apply simultaneous rotations around X, Y and Z axes. Thanks again. Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42037#42037 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] dimension oh a model
Hi Paul, Sorry for my late reply to your post. That is a very good point you bring up about the units of different objects in a scene. When one uses data from USGS in VPB to create a terrain, the rest of the objects have to be scaled up or down to represent their real world size prior to be being used in the scene... But the confusion for me arises when say I load a truck in osg and its dimensions are (12, 6, 8) = (L,W,H). (don't know what units these are in) Without knowing the units of the model (whether 12 feet/meters), how does one apply a scaling factor? I'm not sure if I have explained my point well enough. I can try and re-post if that is the case. Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42038#42038 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] dimension oh a model
Coincidentally that was the approach I was going to take: Place some object of known size on my terrain and scale the unknown units object accordingly, sort of digitally 'eyeballing' it. This empirical approach seems to be the most appropriate way when dealing with objects of unknown units that need to be used with other objects/terrain of a known size ( units). Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42042#42042 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] dimension oh a model
Hi David, I guess I am replying to a rather old post, but I'll try my luck anyway: Adding to your post on getting the size of the terrain, I had a similar question in mind. For a given terrain model (built using osgeart/vpb etc), is there a way to ensure that models loaded on the terrain conform to the scale of the terrain. If I loaded a building model onto a terrain, unless I knows the size of the terrain and the dimensions/scaling it is conforming to, my building model may be unrealistically big/small not representing reality. I was searching along these lines and came across your post and just wanted to check if you had found any tool that helps you do this (getting terrain size) Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41951#41951 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Is it safe/ok to use only PositionAttitudeTransforms instead of MatrixTransforms
Hi Alji, Thanks for your reply. Though I am not sure if I follow your post entirely: rotation of a joint imply rotation of the rest of the arm, rather then computing the Position of each part , you construct a hierarchy of MTs and Multiplying one MT by another apply the change on the rest of the part ... But isn't this the same behavior as having a chain of PATs where modifying one transform node's position/attitude affects all the nodes downstream? Are you implying that it is easier to apply rotations to a series of MT than it is to a similar PAT hierarchy? Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41274#41274 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to represent Scene Graph as a flow chart ?
Thanks Robert..I'll definitely take a look at that. Thanks, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=39755#39755 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to represent Scene Graph as a flow chart ?
Hi, I am building a GUI where users can load individual cad models and then save out the built up object as a single osg model. I am interested in showing the user a symbolic view of the scene graph similar to a flow chart where every node that is added by the user in the main window is shown as an update in the secondary window. I guess somewhat similar to osgedit (which I tried but couldn't build as it seems it is quite out of date?) I was looking for some tips on how I can get started as I am not sure where to get started or if any of the examples show a similar functionality. Thank you Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=39720#39720 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Problems embedding osgViewer::Viewer in Qt MainWindow (not CompositeViewer)
Hi Sergey, Thanks for your reply and suggestions. I will take a look at the link you mentioned. Regards, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=39272#39272 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Is osg 2.9.9 recommended for Qt integration
That is true. I will upgrade to newest build. :) Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=39255#39255 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Problems embedding osgViewer::Viewer in Qt MainWindow (not CompositeViewer)
Hi, I have been trying to modify the osgViewerQtWidget example which has a composite viewer embedded as a widget in a Qt main window. I want to use a single Viewer instead and am thus far not successful. My Qt ui is a simple main window with the central widget upgraded to a ViewerQOSG widget. I've attached my ViewerQOSG class for reference. My problem: In composite viewer we use the ViewQOSG class to 'add views' to the composite viewer. How does that translate to using a simple osgViewer::viewer? I am doing the following in my main function: Code: //..initializing application, loading files etc app.connect( app, SIGNAL(lastWindowClosed()), app, SLOT(quit()) ); osg::ArgumentParser arguments(argc, argv); QPointerOSGWindow mainWindow = new OSGWindow(); //using the promoted widget GraphicsArea which is a ViewerQOSG osg::ref_ptrViewerQOSG viewerWindow = mainWindow-ui.GraphicsArea; //viewerWindow-setCameraManipulator(new osgGA::TrackballManipulator); viewerWindow-setSceneData(Spaceship); //this line gives a lot warnings but makes the viewer to be within the //widget's area viewerWindow-setUpViewerAsEmbeddedInWindow(mainWindow-x(), mainWindow-y(), mainWindow-width(), mainWindow-height()); viewerWindow-frame(); mainWindow-show(); return app.exec(); If any one can tell me what I am doing wrong, I would greatly appreciate. Thank You. Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=39256#39256 Attachments: http://forum.openscenegraph.org//files/viewerqosg_176.cpp http://forum.openscenegraph.org//files/viewerqosg_145.h ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Is osg 2.9.9 recommended for Qt integration
Hi, I have been playing around with the osgviewerQt example that came with osg 2.8.2. Then I looked at the examples that are in the source for 2.9.9 and there seem to be a lot more. Is it recommended that I upgrade or have other users got successful and acceptable results with 2.8.2 (or anything lower than 2.9.9) Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=39224#39224 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Unable to place model on vpb terrain. How To ?
Hi Glenn, Yes that surely helped. I looked at the osg file generated by vpb and didn't see the ellipsoid model in there. Just didn't strike me that I would have to take a different route. P.S. I tried accessing the osgEarth website a couple of times last week but it seemed as though it was down. Thanks again. Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38374#38374 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Unable to place model on vpb terrain. How To ?
Hi, I am trying to place a model on a vpb terrain by supplying the lat-long coordinates. I followed a couple of threads in the forum that suggested to use the CoordinateSystemNode and ellipsoid model. But that didn't work for me (or maybe I am not following it right). I have attached the terrain along with my post. So far this is what I am doing: Code: osg::ref_ptrosg::Group root = new osg::Group(); osg::ref_ptrosg::CoordinateSystemNode csn = new osg::CoordinateSystemNode(); csn-setEllipsoidModel(new osg::EllipsoidModel()); osg::ref_ptrosg::Group terrainGroup = new osg::Group(); //osg::ref_ptrosg::Node terrain = osgDB::readNodeFile(NorthCampus6Levels.osg); osg::ref_ptrosg::Node terrain = osgDB::readNodeFile(NorthCampus6LevelsNoCS.osg); terrainGroup-addChild(terrain); osg::Vec3d m_surface; csn-getEllipsoidModel()-convertLatLongHeightToXYZ(osg::DegreesToRadians(42.291966f), osg::DegreesToRadians(-83.715645f), 0.0f, double(m_surface.x()),double(m_surface.y()),double(m_surface.z()) ); I tried using a visitor to find the CoordSystNode in my scenegraph but when I checked getEllipsoidModel I got a null. I have used osgEarth in the past and was able to place a model on that. But I presently need to use vpb. If anyone can point me in the right direction, it would be great. Thank You. Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38336#38336 Attachments: http://forum.openscenegraph.org//files/northcampus6levels_171.osg ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Unable to place model on vpb terrain. How To ?
Hi Shayne, Thanks for your reply. I have tried a few different things and have a few questions from that: First of, when I try something like this: Code: osg::ref_ptrosg::EllipsoidModel em = csnVisitor.coordinateSystemNode-getEllipsoidModel(); if(!em) { std::cout ellipsoid model is null\n; } //where csnVisitor has a data member storing coordsystemnode To get over this, I need to set the ellipsoid model first and then try the above. This seemed strange but since the ctor is overloaded, I didn't think much of it. But now that the convertXYZToLatLong and vice versa are giving me incorrect results, I am wondering if this maybe a cause?? Second, when I tried using a set of coords for which I had precomputed the geocentric (XYZ) coords from lat-long using osgEarth, I got incorrect numbers. Code: csnVisitor.coordinateSystemNode-getEllipsoidModel()- convertLatLongHeightToXYZ(osg::DegreesToRadians(42.291966f), osg::DegreesToRadians(-83.715645f), 0.0f, terrainPosition.x(), terrainPosition.y(), terrainPosition.z()); double latitude, longitude, height; csnVisitor.coordinateSystemNode-getEllipsoidModel()-convertXYZToLatLongHeight(276119.7034106, 4685765.312, 0.0, latitude, longitude, height); I think I have these functions right. But cannot figure out what maybe causing this error. Third, when I try to get the height above terrain like: Code: osgSim::HeightAboveTerrain::computeHeightAboveTerrain(terrain, terrainPosition) //where terrain position is from the convert to XYZ function This gives me a wrong height value. I wanted to know what it is that I can check or that I maybe doing wrong. I have attached the terrain file (osg) that I am using in case that helps. Thank you Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38350#38350 Attachments: http://forum.openscenegraph.org//files/northcampus6levels_134.osg ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Queer Problem: Saved .osg Model and osgViewer showing differences
Hi Robert, Thanks for your suggestion. I tried saving the files out as .ive and they look perfect when viewed with osgviewer. I was just curious to know, what might be the reason for this behavior ? Thanks again Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37979#37979 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Queer Problem: Saved .osg Model and osgViewer showing differences
Hi, I am having a peculiar problem. I am creating a geode and saving it out as a .osg file. I am also adding this to the osgViewer to see the results of creating the geode. However to my surprise, the model looks correct when I see it in my program using an instance osgviewer. As seen in this image: [Image: http://forum.openscenegraph.org/files/viewerofsamefile_177.jpg ] But I do not see the same result when I open the saved .osg file through osgviewer.exe or load it in a 3rd application later on. As seen in this image: [Image: http://forum.openscenegraph.org/files/savednodefile_919.jpg ] I have attached screen shots of both. I cannot figure out why this would happen? Hoping for some help. Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37908#37908 Attachments: http://forum.openscenegraph.org//files/savednodefile_919.jpg http://forum.openscenegraph.org//files/viewerofsamefile_177.jpg ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Queer Problem: Saved .osg Model and osgViewer showing differences
Hi Paul, I set the OPTIMIZER flag to off in my environment variables in windows. But I still get the same effect. What are the other causes potentially, for this ? Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37912#37912 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How can I check for Polygon-Polygon intersection/distance in OSG ?
Thanks Robert. Regards, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37492#37492 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Can I check for Polygon-Polygon intersection/distance in OSG
Hi, I had a quick question if I can check for intersection/overlap between Polygons of two different 3D models. In addition, is it also possible to find the closest distance between a pair of 3D models as the shortest path between a polygon on obj1 and a polgon on obj2. I am aware that there exist 3rd party graphics libraries that can be used for this. But I wanted to know if I can do this in OSG itself considering I have Polygon lists of my 3D models. Any information on this would be greatly appreciated. Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37483#37483 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Trouble Understanding osgPick (pick example QSG)
Hi Tom, My scene graph structure is: Root--Terrain Root--group1--model1 --autotransform1 --shapefileNode1 Root--group2--model2 --autotransform2 --shapefileNode2 I am trying to pick for model1 and model2 in my graph. So I have modified the pick function as follows: (I changed the polytope to have width = 2.0 and height = 100.0) The thing that puzzles me is when I pick the screen from far out (not zooming in), and output all the nodes in nodePath, the model1 and model2 are not even displayed when I cout the names. I don't know what I am doing wrong here so thought I would post the pick() code as well my scene graph structure. Thanks in advance. Sincerely, Sanat. Code: //perform the pick operation bool pick(const double x, double y, osgViewer::Viewer* viewer) { //colors the drawable in yellow ColorVisitor highlighter; highlighter.setColor(1.0, 1.0, 0.0, 1.0); //colors the drawable in red i.e. the normal un-picked color ColorVisitor redVisitor; highlighter.setColor(1.0, 0.0, 0.0, 1.0); if(!viewer-getSceneData()) //nothing to pick { return false; } double w(2.0); double h(100.0); osgUtil::PolytopeIntersector* picker = new osgUtil::PolytopeIntersector(osgUtil::Intersector::PROJECTION, x-w, y-h, x+w, y+h); osgUtil::IntersectionVisitor iv(picker); viewer-getCamera()-accept(iv); //pipe1Model-accept(iv); if(picker-containsIntersections()) { const osg::NodePath nodePath = picker-getFirstIntersection().nodePath; unsigned int idx = nodePath.size(); std::cout -\n; std::cout size of nodePath is = idx std::endl; while(idx--) { std::cout node name: nodePath.at(idx)-getName() std::endl; //Find the group in the node path //This will be the group to attach our visitor to osg::Node* modelNode = dynamic_castosg::Node*(nodePath.at(idx)); if(modelNode == NULL) { continue; } //if not NULL then a matrix transform was found in the nodePath if(_selectedNode != NULL) { if(_selectedNode-getName() == Model1 || _selectedNode-getName() == Model2) { //clear the previous selected node's callback to make it stop spinning //_selectedNode-setUpdateCallback(NULL); std::cout _selectedNode-getName() std::endl; _selectedNode-accept(redVisitor); } } _selectedNode = modelNode; if(_selectedNode-getName() == Model1 || _selectedNode-getName() == Model2) { std::cout _selectedNode-getName() std::endl; _selectedNode-accept(highlighter); } break; }//while(...) if(!_selectedNode.valid()) { osg::notify() Pick failed. std::endl; } } else if(_selectedNode.valid()) { //_selectedNode-setUpdateCallback(NULL); if(_selectedNode-getName() == Model1 || _selectedNode-getName() == Model2) { std::cout _selectedNode-getName() std::endl; _selectedNode-accept(highlighter); _selectedNode = NULL; } } return _selectedNode.valid(); } Thank you! Cheers, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37328#37328 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Trouble Understanding osgPick (pick example QSG)
Thanks Tom. I will try that out. Cheers, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37342#37342 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to Develop/Create a Cylinder Intersector ??
Hi Wang, Rob, Peter, Thanks for your replies. I try using CylinderIntersector and post my feedback. Cheers, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37343#37343 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to Develop/Create a Cylinder Intersector ??
Hi, I want to test for intersection in my scene using a cylinder instead of a line segment. For example if my object is on a terrain I want to highlight all features that are within an imaginary cylinder around my object. I read about polytope intersector but it seems as though that is for planes only or can I get cylinder intersector from there as well ? Any tips on how I can get started will be much appreciated. Thanks! Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37298#37298 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to Develop/Create a Cylinder Intersector ??
Hi Chris, Ok. I will try that approach. But if I need to use several planes say something like an octagon or even higher number of sides, will that reduce performance terribly ? Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37301#37301 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Trouble Understanding osgPick (pick example QSG)
Hi, I have read through the example in the QSG (quick start guide) as well as example programs for the Picking behavior. I know how the eventAdapter, handle(), etc works. My problem is: In my ctor for picking class I set the two nodes for which I want to check if any of them have been picked. Given that I have the nodePath from the intersector, how can I check if the node I am interested in is in the nodePath ? (I tried using getName and setName but that didn't help) Any help in this matter would be great! (If my explanation has not been clear, I would be happy to re-post) Thanks in advance. Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37303#37303 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Replace Drawable With Actual Geomtry (how to)??
The problem with the code was that I was not setting the matrix translation and rotation correctly. I was doing the following which was not working: translateToCenter = Code: osg::Matrix::translate(osg::Vec3(shapefileVertexArray-at(i).x(), shapefileVertexArray-at(i).y(), shapefileVertexArray-at(i).z())); I then changed it to: Code: translateToCenter.makeTranslate(osg::Vec3(shapefileVertexArray-at(i).x(), shapefileVertexArray-at(i).y(), shapefileVertexArray-at(i).z()) ); It works now and the geometry is getting formed correctly. Thanks everyone. Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37265#37265 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Using AutoTransform as a Label
Hi all, I was wanting to use an AutoTransform as a label for 3D elements in my scene. I have been able to create the Autotransform and add text, etc. However when I try to draw a line between the position of the autotransform and the bound of the object, I don't see any line drawn. I found this puzzling and couldn't figure out why. Any help on this issue would be much appreciated. Just to double check: For the purpose of creating labels, is a Billboard more suitable or an auto transform? (code realted to autotransform is pasted at the end of my post) Thanks. Sincerely, Sanat Code: //create Auto transform to use as a label osg::ref_ptrosg::AutoTransform at1 = new osg::AutoTransform(); osg::Geode* at1Geode = new osg::Geode(); //create txt node osgText::Text* text1 = new osgText::Text(); text1-setFont(timesFont); text1-setCharacterSize(30.0); text1-setText(Pipe1 Owner= DTE); text1-setAlignment(osgText::Text::CENTER_CENTER); //add text to geode at1Geode-addDrawable(text1); at1-addChild(at1Geode); //setup auto transform's properties: at1-setPosition(osg::Vec3d(276377.22, 4685748.0, 1000.0)); at1-setAutoScaleToScreen(true); at1-setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN); //draw line from autotransform to geometry object //create geode and geometry: osg::ref_ptrosg::Geode lineGeode = new osg::Geode(); osg::Geometry* lineGeometry = new osg::Geometry(); //vertex array osg::Vec3Array* vertexArray = new osg::Vec3Array(2); vertexArray-push_back(at1-getPosition()); osg::Vec3 vertex2 = osg::Vec3 (276377.22, 4685748.0, 800.0); //color array osg::Vec4Array* colorArray = new osg::Vec4Array(2); osg::Vec4 yellowColor = osg::Vec4(1.0, 0.0, 0.0, 1.0); colorArray-push_back(yellowColor); //add arrays to geometry lineGeometry-setVertexArray(vertexArray); lineGeometry-setColorArray(colorArray); lineGeometry-setColorBinding(osg::Geometry::BIND_OVERALL); lineGeometry-addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, vertexArray-size())); //attach geometry to geode lineGeode-addDrawable(lineGeometry); lineGeode-getOrCreateStateSet()-setMode(GL_LIGHTING, osg::StateAttribute::OFF); //add the geode to the at1 at1-addChild(lineGeode); //add pipe1 node to group group1-addChild(pipe1.get()); group1-addChild(at1.get()); -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37224#37224 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Replace Drawable With Actual Geomtry (how to)??
Hi Jean, I modified the code in the functions and it seemed fairly straightforward. However, I notice that all the cylinders are rendered at the origin inspite of me doing a glTranslate (which I have commented out now). When I opened the osg file I noticed that the matrix had its last column as 0,0,0,1 - which means that the cylinder did not translate prior to rendering. I tried a number of different things like placing a matrix transform above each Geode while creating the scene graph. But even that didn't quite give any positive results. I have mentioned my cylinder geometry creation code below which returns a Geode. Thanks, Sanat. Code: osg::ref_ptrosg::Geode createCylinderGeode(osg::ref_ptrosg::Cylinder cylinder) //osg::ref_ptrosg::Geode createCylinderGeode(unsigned int numSegments, float RADIUS, float height, // osg::Vec3 center) { unsigned int numSegments = 90; const float angleDelta = 2.0f*osg::PI/(float)numSegments; const float texCoordDelta = 1.0f/(float)numSegments; //const float r = RADIUS; //const float h = height; const float r = cylinder-getRadius(); const float h = cylinder-getHeight(); float basez = -h*0.5f; float topz = h*0.5f; float angle = 0.0f; float texCoord = 0.0f; bool drawFrontFace = true; bool drawBackFace = false; // The only difference between the font back face loops is that the // normals are inverted and the order of the vertex pairs is reversed. // The code is mostly duplicated in order to hoist the back/front face // test out of the loop for efficiency osg::ref_ptrosg::Geode cylinderGeode = new osg::Geode(); osg::ref_ptrosg::Geometry cylinderBody = new osg::Geometry(); osg::ref_ptrosg::Geometry cylinderTop = new osg::Geometry(); osg::ref_ptrosg::Geometry cylinderBottom = new osg::Geometry(); osg::ref_ptrosg::Vec3Array bodyVertexArray = new osg::Vec3Array(); osg::ref_ptrosg::Vec3Array bodyNormalArray = new osg::Vec3Array(); osg::ref_ptrosg::Vec3Array topVertexArray = new osg::Vec3Array(); osg::ref_ptrosg::Vec3Array topNormalArray = new osg::Vec3Array(); osg::ref_ptrosg::Vec3Array bottomVertexArray = new osg::Vec3Array(); osg::ref_ptrosg::Vec3Array bottomNormalArray = new osg::Vec3Array(); //Draw BODY glBegin(GL_TRIANGLE_STRIP); if (drawFrontFace) { for(unsigned int bodyi=0; bodyinumSegments; ++bodyi,angle+=angleDelta,texCoord+=texCoordDelta) { float c = cosf(angle); float s = sinf(angle); bodyNormalArray-push_back(osg::Vec3(c,s,0.0f)); //glTexCoord2f(texCoord,1.0f); bodyVertexArray-push_back(osg::Vec3(c*r,s*r,topz)); //glTexCoord2f(texCoord,0.0f); bodyVertexArray-push_back(osg::Vec3(c*r,s*r,basez)); } // do last point by hand to ensure no round off errors. bodyNormalArray-push_back(osg::Vec3(1.0f,0.0f,0.0f)); //glTexCoord2f(1.0f,1.0f); bodyVertexArray-push_back(osg::Vec3(r,0.0f,topz)); //glTexCoord2f(1.0f,0.0f); bodyVertexArray-push_back(osg::Vec3(r,0.0f,basez)); }//if (drawFrontFace) glEnd(); //glBegin(GL_TRIANGLE_STRIP); //create TOP glBegin(GL_TRIANGLE_FAN); topNormalArray-push_back(osg::Vec3(0.0f,0.0f,1.0f)); //glTexCoord2f(0.5f,0.5f); topVertexArray-push_back(osg::Vec3(0.0f,0.0f,topz)); angle = 0.0f; texCoord = 0.0f; for(unsigned int topi=0; topinumSegments; ++topi,angle+=angleDelta,texCoord+=texCoordDelta) { float c = cosf(angle); float s = sinf(angle); //glTexCoord2f(c*0.5f+0.5f,s*0.5f+0.5f); topVertexArray-push_back(osg::Vec3(c*r,s*r,topz)); } //glTexCoord2f(1.0f,0.5f); topVertexArray-push_back(osg::Vec3(r,0.0f,topz)); glEnd(); //create BOTTOM //glTranslatef(cylunder.center.x(), cylinder.center.y(), cylinder.center.z()); glBegin(GL_TRIANGLE_FAN); bottomNormalArray-push_back(osg::Vec3(0.0f,0.0f,-1.0f)); //glTexCoord2f(0.5f,0.5f); bottomVertexArray-push_back(osg::Vec3(0.0f,0.0f,basez)); angle = osg::PI*2.0f; //texCoord = 1.0f; for(unsigned int bottomi=0; bottominumSegments; ++bottomi, angle -= angleDelta, texCoord -= texCoordDelta) { float c = cosf(angle); float s = sinf(angle); //glTexCoord2f(c*0.5f+0.5f,s*0.5f+0.5f); bottomVertexArray-push_back(osg::Vec3(c*r,s*r,basez)); } //glTexCoord2f(1.0f,0.5f); bottomVertexArray-push_back(osg::Vec3(r,0.0f,basez)); glEnd(); glPopMatrix(); //add vertex array to geometry cylinderBody-setVertexArray(bodyVertexArray.get()); cylinderBody-setNormalArray(bodyNormalArray.get()); cylinderTop-setVertexArray(topVertexArray.get()); cylinderTop-setNormalArray(topNormalArray.get()); cylinderBottom-setVertexArray(bottomVertexArray.get()); cylinderBottom-setNormalArray(bottomNormalArray.get()); //add primitives to geometry cylinderBody-addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_STRIP, 0 , bodyVertexArray-size()));
Re: [osg-users] Replace Drawable With Actual Geomtry (how to)??
Hi Chris, Thanks for the link. I'll take a look. Seems very promising. Thanks Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37089#37089 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Replace Drawable With Actual Geomtry (how to)??
Hi, Hi, I am working on an application that is currently using a Cylinder Drawable object. However I had read that if you have plans on using drawables in a final application that needs high-performance then you probably should create your own geometry library. (from osghelp site) I am using osg Drawable Cylinder to render some 3D models but I need actual geometry as I need the list of primitives and their vertices for further prcoessing. How Can I go from using a Drawable to actual geometry ? Thanks. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37060#37060 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Replace Drawable With Actual Geomtry (how to)??
Hi Jean, Thanks for your post. It was very helpful indeed. (yes I mean ShapeDrawable) My main reason for wanting to create Geometry is that I need to divide the Cylinder object into primitives for further processing and the parser that I had written doesn't seem to work with an osg file created from ShapeDrawable. So I inferred that I need to create geometry rather than shape drawable to obtain primitives. Thanks, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37065#37065 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Accessing Shapefile (GIS) Attribute in OSG
Hi, I have loaded a number of shapefiles using the shp plugin into my scene. I am trying to display the attributes of my shapefile in a billboard. Though right now I am a little confused if I can even access the attributes of my shapefile in the OSG application Hoping for some advise.. Thanks in advance. Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=36140#36140 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Create Cylinder Around Line
Hi Ullrich, I followed the procedure suggested by you and it worked perfectly. However you mentioned that the procedure below But you should replace this with properly constructed geometry. I didn't quite follow what you meant by that. Also, I would like to save each individual geode (geometry) as an osg file to use later and not just load in this scene graph. Is there a way I can do that ? Looking forward to your suggestion. For a quick proof of concept and convenience you can use ShapeDrawables for the cylinders. But you should replace this with properly constructed geometry. That's only a rought outline of course. You may want to skip the NodeVisitor bit for starters and simply use a hard-coded list of start/end points. Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=34959#34959 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Placing an object on VPB (flat) Terrain
Hi, I used osgdem to build a terrain using VPB. I now want to place an object on it whose coordinates would be a random latitude-longitude. I browsed the source and found the ObjectPlacer class. I assume that I will need to use this. But I do not know how to correctly use its place() method objectPlacer.place(vpb::DestinationTile, osg::Node) (do I need to give one of the subtiles .ive as the destinationTile and my object's Node) I looked at the other interface files in the vpb source as well such as DataSet, SourceData, etc but am still confused how to achieve this. Hoping to get some pointers so that I can head in the right direction. Thanks in advance Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=34560#34560 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgTerrain: Terrain Class and TerrainTile Understanding
Hi, I am trying to use osgTerrain together with vpb to achieve dynamic terrain manipulation. After going through the interface for the various classes in osgTerrain, I have a few questions: (whether I have understood right or not) Using virtual planet builder (vpb) we generate a number of sub-tiles with the names such as mapTile_L0_X0_Y0_subtile, mapTile_L1_X0_Y0_subtile...etc (all .ive files) Are these the sub-tiles that can be used as TerrainTile objects ? (I didn't quite figure out how vpb would tie into osgTerrain) If the above is not true then:- As the Terrain class consists of a map of various TerrainTiles and a set, how do we create a multitude of TerrainTile objects to be used in Terrain Hope to get some clarification. Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33963#33963 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Dynamic Terrain
Hi Robert, I read up on osgTerrain and posted my question in a different topic: osgTerrain: Terrain Class and TerrainTile Understanding As I felt it would be better to put it under a different topic than this general one Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33964#33964 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] VPB version for OSG 2.8.2 (0.9.10 not there?)
Hi, I am trying to build VPB with the pre-built packages of osg (version 2.8.2 in my case). The version matrix in the vpb page tells me that I need vpb 0.9.10. However the svn repository only has the latest which demands osg 2.9.5. I wanted to know if earlier src versions could be made available as I would like to use the prebuilt package of osg with VPB Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33882#33882 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VPB version for OSG 2.8.2 (0.9.10 not there?)
Hi Jean, That was very helpful. I got it built and running. Just on a related note- Does VPB store the terrain as a quadtree ? (the reason I am asking is because I am trying to write an app to modify elevations in the terrain at real-time and wanted to know the quickest way to find the elevation node I'm interested in) Thanks for your quick reply. Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33886#33886 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VPB version for OSG 2.8.2 (0.9.10 not there?)
Hi Jean, Thanks for your earlier reply. I can start working on that approach. But I am having issues with osgdem: osgdem is not allowing me to write out the file as I am getting the following error: Error: do not have write permission to write out file output.ive Caught exception : Error: do not have write permission to write out file output. ive I am running the terminal window as administrator so I don't think this is a permission issue. Have you come across something similar or do you know why something like this would come up ? Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33895#33895 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] VPB version for OSG 2.8.2 (0.9.10 not there?)
Hi Chris, That was it...I copied the plugins dll and it worked like a charm. Thanks for helping me out. Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33897#33897 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Dynamic Terrain
@Torben Yes, I want to do the modifications at runtime. It is mainly due to interaction of actors with the terrain causing deformations. My idea is also to modify the height value in the terrain grid and this height value will constantly be updated and rendered to show a sort of real-time terrain deformation. Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33856#33856 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Dynamic Terrain
@Robert: I have read up on a bit of the techniques people have tries to use for this: From what I've read, this is the approach: Represent the terrain as Blocks. Blocks are the basic storage unit for data and are used to transfer data from the CPU to GPU for processing. The Blocks are made up of tiles. Tiles are are the basic rendering unit consisting of Triangles. Terrains are represented at varying resolutions i.e. whole terrain as 1 block or as 4 blocks depending on distance of camera to terrain. (Similar to Mip-Mapping) The vertices of the Terrain Grid are stored in a QuadTree: I am having trouble (maybe I've been reading too much) to figure the steps out: 1) Create 3D terrain mesh using VPB/osgEarth from a USGS dem/tif image 2) Store vertices of the terrain in a QuadTree 3) (How do I ensure the varying resolutions of blocks?) Right now I am having trouble figuring out how to represent the terrain in this format The approach I am thinking for Terrain Deformation is: Build an initial data structure of all the heights of vertices. Allow the 'actor' in the scene to interact with the terrain. If the actor Collides with the terrain then check for the final Global Height of the actor (the component with the lowest global elevation). Update the vertex value in the terrain database with the elevation value obtained from the actor's global value. Render new/updated Terrain mesh. What do you suggest for such an approach? Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33860#33860 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Dynamic Terrain
Hi, I am trying to create a dynamic terrain that can show modifications to the terrain in real-time. I want to show an object removing earth from the terrain and show a hole in that area. Having read a few papers and other sources, I am confused how to go about trying to achieve this in osg ? I have used osgEarth in the past to create a 3D terrain but I believe it cannot be used for the purpose I currently need. Any suggestions would be extremely welcome Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33812#33812 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG TDS (Terrain Deformation Software): Is this part of the functionality ?
Hi, I just came across osgTDS and find it really cool. However, I wanted to know if there is the following functionality intended in osgTDS: (I am open to using any other plugin/library if that allows what I am trying to achieve): If I have characters in my scene that are trying to deform the terrain (dig a hole in the ground, etc), does osgTDS allow me to show a hole in the ground ? I want to be able to show that the terrain has been deformed but it can be deformed further until a particular depth value is reached? I tried searching for terrain deformation but didn't find any definitive answers, so was hoping for some advice/tips from other users. Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33728#33728 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG TDS (Terrain Deformation Software): Is this part of the functionality ?
Sure...what libraries/plugins are you looking at currently/ have looked at in the past ? Thanks. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33733#33733 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Create Cylinder Around Line
Hi Ulrich, I wanted to know if the following is a worthwhile option: I have the data as a shapefile (.shp) and need to create the 3D model from that. I realize that osg can load shp files so is it a good option to modify the plugin dll that loads shp files ? So that when it comes across a polyline feature, it creates a cylinder around it and then loads it. Also, I tried loading a .shp in a trial program and using visual studio debugging step through, I was not able to step through the functions that are called in the dll (i took a look at the dll source code) Look forward to your opinion. Thanks, Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33209#33209 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Create Cylinder Around Line
Hi Ulrich, Sorry for my late reply. I will try these options out, though I have come to realize that it would be better for me to create the cylinders prior to creating .ive files. I was using osgGIS and I may be served well to use one of the filters in that to create a cylinder ive and load in osg. Thanks anywayas always the osg forum is the most helpful forum out there :) Cheers, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=33034#33034 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Create Cylinder Around Line
The code I hav is as below: Every .ive file loads a line object around which I want to draw a cylinder keeping that line as center. Code: int main( int argc, char **argv ) { osg::ref_ptrosg::Group root = new osg::Group(); osg::ref_ptrosg::Node pipe1; osg::ref_ptrosg::Node pipe2; pipe1 = osgDB::readNodeFile(pipes_out1.ive); pipe2 = osgDB::readNodeFile(pipes_out2.ive); pipe3 = osgDB::readNodeFile(pipes_out3.ive); root-addChild(pipe1.get()); root-addChild(pipe2.get()); root-addChild(pipe3.get()); while(!viewer.done()) {...loop...} .. } //main() Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32820#32820 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Create Cylinder Around Line
Hi, I have a number of .ive files that are simple line features. I am trying to create a cylinder around them such that the line is the center of the cylinder. I am not sure how I must go about to do this ? Any pointers will be appreciated. Thanks Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32767#32767 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Getting the List of Triangles from an osg model
Hi, I was able to get a matrix for every geode in my model using the path variable in nodevisitor. However at present I am printing out the triangle vertices to a file using the printTriangles() and a struct, similar to the method show in the osggeometry example. I'm a little confused about how to incorporate the matrices list that I have collected and apply them to each vertex ? Do I need to modify TriangleFunctor and give it a new member variable 'matrix' ? I was hoping for some help in this direction. Code for printing vertices is below: Code: // decompose Drawable primitives into triangles, print //out these triangles and computed normals. void printTriangles(const std::string name, osg::Drawable drawable, const osg::Matrix matrix) { std::cout name std::endl; osg::TriangleFunctorNormalPrint tf; drawable.accept(tf); std::cout std::endl; } struct NormalPrint { void operator() (const osg::Vec3 v1,const osg::Vec3 v2,const osg::Vec3 v3, bool) const { ofstream outFile2; static int i; //open a text file to write the data out if(i == 0) { outFile2.open(backhoe.tris, ios::trunc); } else { outFile2.open(backhoe.tris, ios::app); } assert(!outFile2.fail()); osg::Vec3 normal = (v2-v1)^(v3-v2); normal.normalize(); if ( !outFile2.is_open() ) { std::cout The file could not be opened std::endl; } else { // Safely use the file stream outFile2 i \t(v1), (v2), (v3) std::endl; Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31547#31547 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Getting the List of Triangles from an osg model
Hi, I was able to apply the matrix transforms. Although I simply derived a ModifiedTriangleFunctor class from the original TriangleFunctor class and used function over-ride on the this-operator() therein. Is there a more elegant way to achieve this ? Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31551#31551 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Getting the List of Triangles from an osg model
Hi Tom, Do you know if any of the examples with the source code use this ? I understand the principle but will be helpful if there is some sort of implemetation. Thanks. Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31353#31353 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Getting the List of Triangles from an osg model
Hi Jean, Nick, Paul Thanks for all your suggestions thus far. I was able to extract the triangles and after using the nodeVisitor as suggested by Jean, it is much easier than using a for loop as the code is generic using a visitor. My problem is that I am collecting triangles from a complex model with a number of PAT nodes and when I render the triangles using the other algorithm, the model is obviously seen with the various parts placed without the required transforms. (as seen in the attached screenshot) So I wanted to know what I would need to do if I have to collect the triangles list but then also be able to redraw the model with the correct transforms, so that the various parts are attached like how I have attached them in my osg scene. Thanks Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31340#31340 Attachments: http://forum.openscenegraph.org//files/capture_155.jpg ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Getting the List of Triangles from an osg model
Hi Nick, Yes, Windows and VS 2008. I had to do exactly that. The debugger works normally (as expected) now Thanks, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31245#31245 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Getting the List of Triangles from an osg model
Hi Jean, I was not able to understand this behavior: When I had a vec3Array and I queried it using vec3 = vec3Array-at(0) I would get an exception. Why does it give that exception ? I needed to use (*Vec3Array)[i] to get each Vec3. But then at i = 14113, I got an Unhandled exception: at 0x00402207 in OSG_examples.exe: 0xC005: Access violation reading location 0x00ba9000. And size has a value much higher = 4176061468 when I query the vec3Array for size I get a very large number and much large than Vec3Array-numElements() size = 4176061468 numElements = 7772 Which of these represents the number of vertices in the model ? Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31222#31222 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Getting the List of Triangles from an osg model
Hi Nick, Jean The problem was because I was using the Release version of osg. I used the Debug instead and both size and numElements give the same value. I had turned optimization off but it seems as though you cannot run through the code even then. Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31230#31230 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Getting the List of Triangles from an osg model
Hi, I am having trouble figuring out how I can get the list of triangles (vertices) that make up an osg object to use in another algorithm that needs a list of triangle vertices that make up the model. (I have seen the models I intend to use in osgviewer using the 'w' key and they are made up of only triangles. So if I am using either a .osg model or a model loaded through osgDB::readNodeFile(...), I would like to store in memory the list as above. I was hoping to get some tips on how I can start approaching this. (I hope I have been able to explain my problem clearly enough) Thank You Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31163#31163 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Getting the List of Triangles from an osg model
Hi Paul, Thanks for your suggestion. I take a look at tiranglefunctor. I am trying to get the list of vertices like this: (the algorithm that I'm trying to use, uses a file type called TRI or TRIS which is basically a list of triangle vertices that it then uses to compare with another model's vertices: Code: TRI 1000 1996 -0.42173630748 -0.002298619180003688 0.001594571375850673 -0.04134986807655005 0.05770563707444018 -0.4949345894761177 -0.4529553837855104 0.1495382066464429 0.1498991162505212 0.4346928959408253 -0.2437053375790935 0.04061766431046052 0.3309653461123563 -0.2704424251427986 -0.2594664416752355 0.02970019333516602 0.1638967733743646 -0.4714400769910478 -0.1165843492451138 -0.477629262623616 -0.09098558675261177 Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31173#31173 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Getting the List of Triangles from an osg model
Hi, I was running a small test program to understand the concept a little better: Code: int main() { int numChildren, num1, num2, num3; const char* geodeName; const char* cowChildrenName; osg::Group* root = new osg::Group(); osg::Node* cow = osgDB::readNodeFile(cow.osg); root-addChild(cow); geodeName = cow-asGroup()-getChild(0)-className(); numChildren = root-getNumChildren(); num1 = cow-asGroup()-getChild(0)-asGeode()-getNumDrawables(); num2 = cow-asGroup()-getNumChildren(); num3 = cow-asGeode()-getNumDrawables(); _getch(); return 0; } The cow Node has 1 child i.e. a Geode. But when I try and query it for number of drawables using the line num3 = cow-asGeode()-getNumDrawables(); I get an exception error. So how do I query it or get the number of drawables ? Thanks. Sincerely, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31175#31175 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Getting the List of Triangles from an osg model
Hi Jean, Yes, I realize my mistake. I went through that section in the Quick Start Guide to refresh my memory. Thanks. Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31178#31178 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Proximity Queries between objects
Hi Jean, Yes, I have the local bounding spheres of each of the child nodes. But I'm still not clear what I need to do to join all the bounding spheres of the child nodes for the entire model ? In the code below I'm loading the lwo files and creating local bounding spheres for each of the components: Code: //load the CAD files: Backhoe = new osg::Group(); Stick = new osg::Node(); Boom = new osg::Node(); Target = new osg::Node(); Bucket = new osg::Node(); Track = new osg::Node(); Cabin = new osg::Node(); LoadBack = new osg::Node(); Stick = osgDB::readNodeFile(_BHStic_.lwo); Boom = osgDB::readNodeFile(_BHBoom_.lwo); Target = osgDB::readNodeFile(_BHTarg_.ac); Bucket = osgDB::readNodeFile(_BHBuck_.lwo); Track = osgDB::readNodeFile(_BHTrac_.lwo); Cabin = osgDB::readNodeFile(_BHCabi_.lwo); LoadBack = osgDB::readNodeFile(_BHLdBk_.lwo); //bounding spheres: //initialize here itself (unitialized references cannot exist) const osg::BoundingSphere StickSphere = Stick-getBound(); const osg::BoundingSphere BoomSphere = Boom-getBound(); const osg::BoundingSphere TargetSphere = Bucket-getBound(); const osg::BoundingSphere BucketSphere = Cabin-getBound(); const osg::BoundingSphere TrackSphere = Target-getBound(); const osg::BoundingSphere CabinSphere = LoadBack-getBound(); const osg::BoundingSphere LoadBackSphere = Track-getBound(); Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30979#30979 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Proximity Queries between objects
Hi Jean, I used bounding spheres on the transform nodes and that helped me get the distance. Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30983#30983 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Proximity Queries between objects
Hi, I tried the following code: Code: //BoundingSphere using computeBound() osg::BoundingSphere bh1Sphere = backhoe1Group-computeBound(); osg::BoundingSphere bh1PATSphere = backhoe1PAT-computeBound(); //BoundingSpere using computeBound(): osg::BoundingSphere bh2Sphere = backhoe2Group-computeBound(); osg::BoundingSphere bh2PATSphere = backhoe2PAT-computeBound(); .. float x1, x2, y1, y2, distance; if(bh1Sphere.intersects(bh2Sphere)) { std::cout The backhoes are colliding !! std::endl; x1 = bh1Sphere.center().x(); x2 = bh2Sphere.center().x(); y1 = bh1Sphere.center().y(); y2 = bh2Sphere.center().y(); distance = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)); std::cout distance = distance; std::cout std::endl; } else { x1 = bh1Sphere.center().x(); x2 = bh2Sphere.center().x(); y1 = bh1Sphere.center().y(); y2 = bh2Sphere.center().y(); distance = sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)); std::cout distance = distance; std::cout std::endl; } However, both the spheres (1 and 2) have the same centre coordinates. When I try the same thing using spheres that are bounds for the top-most PATNodes, I again get the same result (i.e. centre coordinates are the same). I find this confusing as both the nodes have different positions. Is this a sensible approach to take though ? Cheers, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30880#30880 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Proximity Queries between objects
Hi, My 3d model is a number of nodes linked by PATs and a Group node right on top. So when I was going through the methods, I observed that the getBound() works only for nodes. Then I also came across the computeBound() which can be used with Group nodes. Code: virtual BoundingSphere osg::Group::computeBound () const [virtual] Compute the bounding sphere around Node's geometry or children. This method is automatically called by getBound() when the bounding sphere has been marked dirty via dirtyBound(). Reimplemented from osg::Node. So I wasn't sure which is the method to go ? If I compute bounding spheres for each node that makes up my 3d model, can I link all of them so that I can check for proximity between another 3d model and this one ? If any of the examples deal with something similar, I would be glad to go through that but I didn't know which one. Thank You Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30860#30860 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Proximity Queries between objects
Hi Jean, I am looking at osgBullet but for some reason all the binaries dont run after building it. Also, is there any tutorial that explains how to link osgbullet with an already existing osg project ? Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30797#30797 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Proximity Queries between objects
Hi Paul, That is the method I had initially thought of (i.e. the distance between centres of spheres obviously :) and not the other one !) I was building osgbullet and am able to build the projects in visual studio successfully. All my dependencies are built right as osgWorks' binaries run alright. But osgBullet's binaries hang on me when I try to run them. I will post that in a seperate thread as it will be misleading to discuss it in this one. Thanks. Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30798#30798 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgBullet Build unsuccessful
Hi, I am trying to build osgBullet and while the projects build correctly in VisualStudio, when I try to run the binaries created, they hang on me. I hav the binaries from osgBullet and osgWorks copied into the binaries folder for osgBullet. When I opened the dll for osgdb_osgbBullet.dll in depends.exe, I got the following: MSJAVA.DLL : System cannot find the file specified. And osgbBullet.dll: MSJAVA.DLL : System cannot find the file specified. I cannot understand why this dll would be causing my binaries to hang. I was hoping to get some advise from other users who have built osgBullet successfully or who may have experienced any similar problems. Thank you Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30799#30799 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgBullet Build unsuccessful
Hi Fred, I'll try that out. THanks. Sorry Paul, I didn't realize there was a google groups separately for osgBullet. Thanks, Sanat.[/quote] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30809#30809 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG in Delta3D
Hi Tony,Jan I did go through delta 3d's tutorials and found that it had a lot more than I might need for now. Plus I felt it was much simpler to set up a scene and go from there in osg or maybe that's just because I have been using osg. I will look at osgBullet and integrate it. Thanks Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30747#30747 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Proximity Queries between objects
Hi, I am interested in knowing if there is some tool in osg that I can use to perform proximity queries between a pair of objects. I looked at osgbullet. But it offers a lot more than what I basically need. One approach that I have thought of is using distance formula between the PATs-position of the two objects. But with this, I won't get the object edge to object edge distance (i think) So, I wanted to know if there is some way in OSG I can compute the shortest distance between the boundaries of two objects. Thank You. Sincerely, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30749#30749 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG in Delta3D
Hi, I am interested in adding Collision Detection to my current OSG application. And after going through a number of threads on this topic, the common theme was use Delta 3D. So my question is: Can I use my current OSG code as is, in Delta 3D and then just add other features (like collision detection) to the app ? Or does my osg code need to change to allow me to use it in Delta3D ? Thank You. Sincerely. Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30739#30739 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transfer osgViewer stream wirelessly to a remote monitor
Hi Jean, Your suggestion to study the function that is called from the code was a very good one indeed. This way, you do not have to Thanks !! Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30663#30663 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transfer osgViewer stream wirelessly to a remote monitor
Hi Jean, I decided to take the approach that displays graphics in a window. I am able to get 2 windows. But right now, both monitors are displaying 2 windows. I am not able to separate window 1 to screen 1 and window 2 to screen 2 only. I tried following what you had suggested but I still get 2 windows in each screen: I have 2 graphics context - gc and gc2 (gc handles views 0, 1, 2 and gc2 view 3) Below is how I have setup the graphics context and windowing system interface: Code: osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); if (!wsi) { osg::notify(osg::NOTICE)Error, no WindowSystemInterface available, cannot create windows.std::endl; return 1; } unsigned int windowWidth1, windowHeight1; unsigned int windowWidth2, windowHeight2; wsi-getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), windowWidth1, windowHeight1); wsi-getScreenResolution(osg::GraphicsContext::ScreenIdentifier(1), windowWidth2, windowHeight2); osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = 100; traits-y = 100; traits-width = 1000; traits-height = 800; traits-windowDecoration = true; traits-doubleBuffer = true; traits-sharedContext = 0; osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptrosg::GraphicsContext gc2 = osg::GraphicsContext::createGraphicsContext(traits.get()); if (gc.valid() gc2.valid()) { osg::notify(osg::INFO) GraphicsWindow has been created successfully.std::endl; // need to ensure that the window is cleared make sure that the complete window is //set the correct colour rather than just the parts of the window that are //under the camera's viewports gc-setClearColor(osg::Vec4f(0.2f,0.2f,0.6f,1.0f)); gc-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); gc2-setClearColor(osg::Vec4f(0.2f,0.2f,0.6f,1.0f)); gc2-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } else { osg::notify(osg::NOTICE) GraphicsWindow has not been created successfully.std::endl; } This is the code for the window in the 2nd monitor (or view 3) Code: // view 3 { osgViewer::View* view = new osgViewer::View; view-setUpViewOnSingleScreen(1); view-setName(View four); viewer.addView(view); view-setSceneData(root); view-addEventHandler(keh.get()); view-getCamera()-setName(Cam four); view-getCamera()-setProjectionMatrixAsPerspective(30.0, double(traits-width) / double(traits-height), 1.0, 1000.0); view-getCamera()-setViewport(new osg::Viewport(0, 0, traits-width, traits-height)); view-getCamera()-setGraphicsContext(gc2.get()); view-setCameraManipulator(new osgGA::TrackballManipulator); osgGA::NodeTrackerManipulator* backhoeTracker = new osgGA::NodeTrackerManipulator(); backhoeTracker-setTrackNode(backhoe1.getBackhoe()); view-setCameraManipulator(backhoeTracker); } Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30584#30584 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transfer osgViewer stream wirelessly to a remote monitor
Hi Jean, You were right that my graphics card settings were not set to Configured independently from each other (Dual View). I updated the settings in the nvidia Control Panel and now have behavior similar to what you described with being able to drag windows across screens, etc. But unfortunately, for my application, when I run the program: Screen 1 just has the Windows Taskbar with the osgviewer windows minimized. The osgviewer windows can be viewed in the maximized state only in Screen 2. I used: view-setUpViewOnSingleScreen(1); //for views 1,2,3 with graphics context gc view-setUpViewOnSingleScreen(2); //for view 4 with graphics context gc2 --- I am hoping to get the behavior where window 1 is seen on screen-1 and window 2 on screen-2. I'm using Widnows XP and my graphics card is Nvidia Geforce 6800. Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30596#30596 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transfer osgViewer stream wirelessly to a remote monitor
Hi Fred, I had tried 0 and 1 before but that gave me the exact same behavior. So in your application you have a different osgviewer window that displays in each screen the moment your program starts running ? I don't know if there is something wrong in the way I'm setting up my graphics context and widnowing system interface, if you're able to achieve something similar to what I'm trying. If its any reference, my code for the graphics context part is copied below: Code: osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); if (!wsi) { osg::notify(osg::NOTICE)Error, no WindowSystemInterface available, cannot create windows.std::endl; return 1; } unsigned int windowWidth1, windowHeight1; unsigned int windowWidth2, windowHeight2; wsi-getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), windowWidth1, windowHeight1); wsi-getScreenResolution(osg::GraphicsContext::ScreenIdentifier(1), windowWidth2, windowHeight2); osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = 100; traits-y = 100; traits-width = 1000; traits-height = 800; traits-windowDecoration = true; traits-doubleBuffer = true; traits-sharedContext = 0; osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptrosg::GraphicsContext gc2 = osg::GraphicsContext::createGraphicsContext(traits.get()); osg::ref_ptrosg::GraphicsContext gc3 = osg::GraphicsContext::createGraphicsContext(traits.get()); if (gc.valid() gc2.valid() gc3.valid()) { osg::notify(osg::INFO) GraphicsWindow has been created successfully.std::endl; // need to ensure that the window is cleared make sure that the complete window is //set the correct colour rather than just the parts of the window that are //under the camera's viewports gc-setClearColor(osg::Vec4f(0.2f,0.2f,0.6f,1.0f)); gc-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); gc2-setClearColor(osg::Vec4f(0.2f,0.2f,0.6f,1.0f)); gc2-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); gc3-setClearColor(osg::Vec4f(0.2f,0.2f,0.6f,1.0f)); gc3-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } Thanks. Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30600#30600 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transfer osgViewer stream wirelessly to a remote monitor
Hi Jean, Thanks for that. It helped me solve the problem. Also, I wanted to know if trial and error is the way one can pick up the intricacies of osg, as there is so much in the api, its very difficult to know how it all works. Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30602#30602 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transfer osgViewer stream wirelessly to a remote monitor
Hi Torben, I haven't decided on what the remote side architecture would be. I was not sure if I needed to have a full fledged PC on the remote side or could I get away with using a monitor connected to a device that receives the wireless video feed. Not having a full fledged OC on the remote side would be my preferred option. If you replace this monitor with a video transmitter hardware, you could send this local rendered output to your reciever monitor. I'm sorry but I don't know how this could be achieved (what parts)? Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30560#30560 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transfer osgViewer stream wirelessly to a remote monitor
Hi Torben, Jason Thanks for the explanation, I clearly understand the video transmission part now. But using a set up such as that, I am basically transmitting the entire video feed to the remote screen. I am interested in sending the rendering of only 1 of those 3 viewports(1 view from the compositeViewer), not all 3. (as seen in the attachment below). With that being the case, does it make more sense to use the image based approach ? the rendering the image on the master pc and transfering the final image Or can it still be achieved using the method in the earlier post ? Thanks for the help ! Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30567#30567 Attachments: http://forum.openscenegraph.org//files/test_scrshot_inset_151.jpg ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transfer osgViewer stream wirelessly to a remote monitor
Hi Skylark, Thanks for your reply Are there any examples in the source that show how to only render the bottom left viewport on the second monitor (basically a generic example for selective rendering) or any suggested reading ? Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30569#30569 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transfer osgViewer stream wirelessly to a remote monitor
Thanks Jean, I'll try this out right away using a cable for the remote screen for now. -Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30571#30571 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Transfer osgViewer stream wirelessly to a remote monitor
Hi, I am not sure if I have phrased my question correctly, so I'll try to explain what I am trying to achieve. I am using osgCompositeViewer with 3 views as seen in the screenshot attached. I am interested in wirelessly transmitting the thread for one of the views (bottom left one) to a remote monitor/HUD. I just don't know if something like this is possible and if so, what I need to follow ? I hope I have been able to explain myself clearly. If I can get some leads it would be very helpful. Thanks! Regards, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30545#30545 Attachments: http://forum.openscenegraph.org//files/test_scrshot_165.jpg ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Transfer osgViewer stream wirelessly to a remote monitor
Hi Ulrich, Thread? I assume you want to transmit the *image* to a remote monitor? Or do you want to somehow migrate the rendering to another box? Yes, basically when the simulation is running on my main PC, I want to view the exact same simulation on a remote monitor/screen. (In this case, the reote monitor could only show the bottom left portion of the screen as seen in my attached screen-shot). Or you could look at a hardware solution where you send the 'remote' image to another local screen and only transmit the video signal to the remote monitor. I'm sorry, I did not understand the above. How do you normally transmit a video signal ? (using a typical radio modem at my server side PC and another radio receiver at the remote pc side) Thanks Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30547#30547 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Display distance between 2 objects
Hi Ulrich, Thanks for that suggestion. I didn't know that the keyboard handler handle() function gets called regardless of whether the key is pressed or not. Thanks, Sanat. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30407#30407 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgViewerMFC example (linking errors)
Hi Cory, That was it. Thanks for catching that out. Best, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30346#30346 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Display distance between 2 objects
Hi, I have been able to display a text box in my application but my problem is something like this: I have 2 PAT nodes under a root node. I want to display the distance between these 2 nodes using simple distance formula at every run of the traversal. Currently I have the text box added to my keyboard event handler. And it displays updated information like which node is under control eveytime I hit a key. However I want to display the distance without having hit a key. Code: TextBox * t1 = new TextBox(); t1-setPosition(osg::Vec3d(0, 450, 0)); t1-setText(str1); .. osg::ref_ptrKeyboardHandler keh = new KeyboardHandler; keh-setPAT(backhoe1PAT, backhoe2PAT); keh-setTextBox(t1); If I add update callbacks to the individual nodes, I wont be able to access the position info of the other PAT. So I was wanting to know how I can go about this issue. Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30356#30356 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgViewerMFC example (linking errors)
bump hoping to kno if any of you guys have faced this problem/any solutions ? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30239#30239 ___ 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 Tom, Yes, I should have probbaly tried outputting values to the console a little earlier. It appears there is a bug in VS 2005 while setting a watch on variables in member functions in classes. So I have managed to narrow down my problem to the following lines of code: xPos and yPos are legitimate value. However backhoeContactPoint.x and .y show 0 as output. I also noted that the Intersection backhoeIntersection has its member matrixd showing: error unable to access inavlid memory location. But this method was working for me when I was updating position through keyboard input. Code: //PROBLEM STARTS FROM HERE AS CONSOLE OUTPUT SHOWS VALUE 0: osgUtil::LineSegmentIntersector* backhoeLocationSegment = new osgUtil::LineSegmentIntersector( osg::Vec3d(xPos, yPos, 9), osg::Vec3d(xPos, yPos, -9)); osgUtil::IntersectionVisitor findBackhoeElevationVisitor; findBackhoeElevationVisitor.setIntersector(backhoeLocationSegment); surface-accept(findBackhoeElevationVisitor); osgUtil::LineSegmentIntersector::Intersection backhoeIntersection = backhoeLocationSegment-getFirstIntersection(); osg::Vec3d backhoeContactPoint = backhoeIntersection.getWorldIntersectPoint(); Console::WriteLine(backhoeContactPoint.x: {0}, backhoeContactPoint.x()); Console::WriteLine(backhoeContactPoint.y: {0}, backhoeContactPoint.y()); return backhoeContactPoint; What can I infer from this ? Thanks, Sanat -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=30214#30214 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org