Re: [osg-users] crash in frame(); in the multithreading
Based on your opinion that the crash is *a straight iterator invalidation issue due to your add/removing stuff from the scene graph.* , can you give me some suggestions on fix the bug? the codes was so huge that i can't paste it in mail. Thanks a lot. Xiaodong. On Fri, Jul 18, 2008 at 6:13 PM, Robert Osfield [EMAIL PROTECTED] wrote: 2008/7/18 Wu Xiaodong [EMAIL PROTECTED]: In my case, I added some new child-node to a group-node, then it crashed some times; Could the bug be fixed if i call osg::Group::setDataVariance ( )? Setting DataVariance on the Group will have no effect, it only is critical for StateSet and Drawable. It could be that your crash has nothing to do with threading though, and is a straight iterator invalidation issue due to your add/removing stuff from the scene graph. Since I don't have your code in front of me I can but guess at what the cause might be. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Xiaodong Wu 吴晓东 'Xiao' means the time and the view when the sun rises and 'dong' means the east in Chinese ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] crash in frame(); in the multithreading
I debug my code once more. Your judgment was right. In the single thread, it crashed also. Thanks. Xiaodong 2008/7/22 Wu Xiaodong [EMAIL PROTECTED]: Based on your opinion that the crash is *a straight iterator invalidation issue due to your add/removing stuff from the scene graph.* , can you give me some suggestions on fix the bug? the codes was so huge that i can't paste it in mail. Thanks a lot. Xiaodong. On Fri, Jul 18, 2008 at 6:13 PM, Robert Osfield [EMAIL PROTECTED] wrote: 2008/7/18 Wu Xiaodong [EMAIL PROTECTED]: In my case, I added some new child-node to a group-node, then it crashed some times; Could the bug be fixed if i call osg::Group::setDataVariance ( )? Setting DataVariance on the Group will have no effect, it only is critical for StateSet and Drawable. It could be that your crash has nothing to do with threading though, and is a straight iterator invalidation issue due to your add/removing stuff from the scene graph. Since I don't have your code in front of me I can but guess at what the cause might be. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Xiaodong Wu 吴晓东 'Xiao' means the time and the view when the sun rises and 'dong' means the east in Chinese -- Xiaodong Wu 吴晓东 'Xiao' means the time and the view when the sun rises and 'dong' means the east in Chinese ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] crash in frame(); in the multithreading
In my case, I added some new child-node to a group-node, then it crashed some times; Could the bug be fixed if i call osg::Group::setDataVariancefile:///E:/Oil/OpenSceneGraphReferenceDocs/a01315.html#a11( )? thanks. 2008/7/18 Robert Osfield [EMAIL PROTECTED]: Hi Xiadong, If you are updating StateSet/StateAttribute or Drawables/Geometry in your update then you should mark their DataVariance to DYNAMIC so that the draw traversal knows not to release the current frame till they are all done. Robert. 2008/7/18 Wu Xiaodong [EMAIL PROTECTED]: Hi. I begin a new thread for osg::Viewer()::frame(); I create a simple scene , then call osg::Viewer::frame() ; it all works well; while I add some chilld-nodes to a group node, then it crashed in frame(); Is the error generated because of the multi-thread or something; what should I do when insert some new children to scene to avoid this kind of crash? Thanks; xiaodong. //the calling stack is as following osg33-osgd.dll!std::_Vector_const_iteratorosg::ref_ptrosg::Node,std::allocatorosg::ref_ptrosg::Node ::operator++() Line 117 + 0x33 bytesC++ osg33-osgd.dll!std::_Vector_iteratorosg::ref_ptrosg::Node,std::allocatorosg::ref_ptrosg::Node ::operator++() Line 337C++ osg33-osgd.dll!osg::Group::traverse(osg::NodeVisitor nv={...}) Line 60 + 0x8 bytesC++ osg33-osgd.dll!osg::NodeVisitor::traverse(osg::Node node={...}) Line 181 + 0x1c bytesC++ osg33-osgUtild.dll!osgUtil::UpdateVisitor::handle_callbacks_and_traverse(osg::Node node={...}) Line 84 + 0x25 bytesC++ osg33-osgUtild.dll!osgUtil::UpdateVisitor::apply(osg::Group node={...}) Line 54 + 0x1a bytesC++ osg33-osgd.dll!osg::Group::accept(osg::NodeVisitor nv={...}) Line 38 + 0x41 bytesC++ osg33-osgd.dll!osg::Group::traverse(osg::NodeVisitor nv={...}) Line 62 + 0x25 bytesC++ osg33-osgd.dll!osg::NodeVisitor::traverse(osg::Node node={...}) Line 181 + 0x1c bytesC++ osg33-osgUtild.dll!osgUtil::UpdateVisitor::handle_callbacks_and_traverse(osg::Node node={...}) Line 84 + 0x25 bytesC++ osg33-osgUtild.dll!osgUtil::UpdateVisitor::apply(osg::Group node={...}) Line 54 + 0x1a bytesC++ osg33-osgd.dll!osg::Group::accept(osg::NodeVisitor nv={...}) Line 38 + 0x41 bytesC++ osg33-osgViewerd.dll!osgViewer::Viewer::updateTraversal() Line 837 + 0x32 bytesC++ osg33-osgViewerd.dll!osgViewer::ViewerBase::frame(double simulationTime=1.7976931348623157e+308) Line 582 + 0xf bytesC++ -- Xiaodong Wu 吴晓东 'Xiao' means the time and the view when the sun rises and 'dong' means the east in Chinese ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Xiaodong Wu 吴晓东 'Xiao' means the time and the view when the sun rises and 'dong' means the east in Chinese ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] crash in frame(); in the multithreading
Hi. I begin a new thread for osg::Viewer()::frame(); I create a simple scene , then call osg::Viewer::frame() ; it all works well; while I add some chilld-nodes to a group node, then it crashed in frame(); Is the error generated because of the multi-thread or something; what should I do when insert some new children to scene to avoid this kind of crash? Thanks; xiaodong. //the calling stack is as following osg33-osgd.dll!std::_Vector_const_iteratorosg::ref_ptrosg::Node,std::allocatorosg::ref_ptrosg::Node ::operator++() Line 117 + 0x33 bytesC++ osg33-osgd.dll!std::_Vector_iteratorosg::ref_ptrosg::Node,std::allocatorosg::ref_ptrosg::Node ::operator++() Line 337C++ osg33-osgd.dll!osg::Group::traverse(osg::NodeVisitor nv={...}) Line 60 + 0x8 bytesC++ osg33-osgd.dll!osg::NodeVisitor::traverse(osg::Node node={...}) Line 181 + 0x1c bytesC++ osg33-osgUtild.dll!osgUtil::UpdateVisitor::handle_callbacks_and_traverse(osg::Node node={...}) Line 84 + 0x25 bytesC++ osg33-osgUtild.dll!osgUtil::UpdateVisitor::apply(osg::Group node={...}) Line 54 + 0x1a bytesC++ osg33-osgd.dll!osg::Group::accept(osg::NodeVisitor nv={...}) Line 38 + 0x41 bytesC++ osg33-osgd.dll!osg::Group::traverse(osg::NodeVisitor nv={...}) Line 62 + 0x25 bytesC++ osg33-osgd.dll!osg::NodeVisitor::traverse(osg::Node node={...}) Line 181 + 0x1c bytesC++ osg33-osgUtild.dll!osgUtil::UpdateVisitor::handle_callbacks_and_traverse(osg::Node node={...}) Line 84 + 0x25 bytesC++ osg33-osgUtild.dll!osgUtil::UpdateVisitor::apply(osg::Group node={...}) Line 54 + 0x1a bytesC++ osg33-osgd.dll!osg::Group::accept(osg::NodeVisitor nv={...}) Line 38 + 0x41 bytesC++ osg33-osgViewerd.dll!osgViewer::Viewer::updateTraversal() Line 837 + 0x32 bytesC++ osg33-osgViewerd.dll!osgViewer::ViewerBase::frame(double simulationTime=1.7976931348623157e+308) Line 582 + 0xf bytesC++ -- Xiaodong Wu 吴晓东 'Xiao' means the time and the view when the sun rises and 'dong' means the east in Chinese ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph 2.4 released
Greate Work. Thanks Robert! On Fri, Apr 25, 2008 at 8:34 PM, Robert Osfield [EMAIL PROTECTED] wrote: I have just tagged OpenSceneGraph-2.4 stable release and update the front page downloads pages with new release, you can grab 2.4 from the downloads page: http://www.openscenegraph.org/projects/osg/wiki/Downloads The press release for the 2.4 release can be found at : http://www.openscenegraph.org/projects/osg/wiki/News/Press/OSG2.4 Updates include: * Support for OpenGL Geometry shaders * Support for OpenGL Multiple Render Targets extension to Frame Buffer Objects * Support for OpenGL Occlussion Query extension * New OpenFlight writer * New libcurl based plugin for reading http hosted databases * Quicktime based reading of live video streams under Windows and OSX * Better load balancing in database pager * Improvements to osgTerrain for support of terabyte scale whole earth terrain databases * Additions to the Shapefile loader with .dbf attribute file, .proj projection file support and loading data as doubles * Enhanced intersection functionality including double support for line intersections * Parallel build support under Visual Studio * Support for reading Producer .cfg viewer configuration files * A wide range of build and bug fixes For a full list of changes consult the ChangeLog. I would like to pass on my heart felt thanks to all those who've contributed to the release, a full list of contributors (now 307 of us) to the OSG can be found at: http://www.openscenegraph.org/projects/osg/wiki/Support/Contributors/TwoPointFour Have fun! Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Xiaodong Wu 吴晓东 'Xiao' means the time and the view when the sun rises and 'dong' means the east in Chinese ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgSim::ScalarBar: supporting the osgText::String title;
Hi. I try to update the class osgSim::ScalarBar to support for the osgText::String title. it may be very simple. but I hope i can do something to OSG. Thanks. xiaodong // header == /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGSIM_SCALARBAR #define OSGSIM_SCALARBAR 1 #include osgSim/Export #include osgSim/ColorRange// The default ScalarsToColors is a ColorRange #include osg/Geode #include string *//adding by the Xiaodong Wu [EMAIL PROTECTED] //to support for the osgText::String title; #include osgText/String* namespace osgSim { /** A ScalarBar is an osg::Geode to render a colored bar representing a range of scalars. The scalar/color ranges are specified by an instance of ScalarsToColors. There are a number of configurable properties on the ScalarBar, such as the orientation, the number of labels to be displayed across the range, the number of distinct colors to use when rendering the bar, text details etc. In summary, the main configurables on the ScalarBar are: -# The range of scalars represented by the bar, and the colors corresponding to this range - these are specified by the ScalarsToColors object. -# The number of colors used when rendering the bar geometry - this may be thought of as the bar 'density'. -# The number of text labels to be used when displaying the bar. The other configurables should be self-explanatory. */ class OSGSIM_EXPORT ScalarBar: public osg::Geode { public: /** ScalarBar orientation specification. */ enum Orientation{ HORIZONTAL, /// a horizontally ascending scalar bar (x-axis) VERTICAL/// a vertically ascending scalar bar (y-axis) }; /** Users may provide their own ScalarPrinter by deriving from this base class and overriding the printScalar() method. Users may map the scalar float passed in to any string they wish. */ struct OSGSIM_EXPORT ScalarPrinter: public osg::Referenced { virtual std::string printScalar(float scalar); }; /** TextProperties allows users to specify a number of properties for the text used to display the labels title on the ScalarBar. Specifiying a character size of 0 will cause the ScalarBar to estimate an appropriate size. Note that the attributes are public, and may be set directly. */ struct TextProperties { std::string _fontFile; std::pairint,int _fontResolution; float _characterSize; osg::Vec4 _color; TextProperties(): _fontFile(fonts/arial.ttf), _fontResolution(40,40), _characterSize(0.0f), _color(1.0f,1.0f,1.0f,1.0f) { } }; /** Default constructor. */ ScalarBar(): osg::Geode(), _numColors(256), _numLabels(11), _stc(new ColorRange(0.0f,1.0f)), _title(Scalar Bar), _position(0.0f,0.0f,0.0f), _width(1.0f), _aspectRatio(0.03), _orientation(HORIZONTAL), _sp(new ScalarPrinter) { createDrawables(); } /** Construct a ScalarBar with the supplied parameters. @param numColorsSpecify the number of colors in the scalar bar. Color interpolation occurs where necessary. @param numLabelsSpecify the number of labels in the scalar bar. @param stc The ScalarsToColors defining the range of scalars and the colors they map to. @param titleThe title to be used when displaying the ScalarBar. Specify for no title. @param orientation The orientation of the ScalarBar. @see Orientation. @param aspectRatio The aspect ration (y/x) for the displayed bar. Bear in mind you may want to change this if you change the orientation. @param sp A ScalarPrinter object for the ScalarBar. For every displayed ScalarBar label, the scalar value will be passed to the ScalarPrinter object to turn it into a string. Users may override the default ScalarPrinter object to map scalars to whatever strings they wish. @see ScalarPrinter */ ScalarBar(int numColors, int numLabels, ScalarsToColors* stc, const
Re: [osg-users] OpenSceneGraph-2.3.7 dev release tagged.
Hi. Robert. Yeah. Great! The western humor. The misunderstanding may be caused by the time equation, because the time for the mail is April 2nd as the time zone on my PC. I am in the GMT +8:00 time zone. To be honest, it would be evil if the April 1st joke were real in my mind. On Thu, Apr 3, 2008 at 4:40 PM, Robert Osfield [EMAIL PROTECTED] wrote: Hi Xiaodong Wu et. al, 2008/4/3 Wu Xiaodong [EMAIL PROTECTED]: How could the community do when the next Microsoft Technologies, such as DirectX changes like OS changes from Win95 to WinXp. The email about adopting Microsoft Technologies across the board was a April 1st spoof, written to be almost plausible but also ridiculous at the same time, and once you realise it's a joke you know you've been had. Such pranks are a tradition on April 1st every year in at least the UK and US. I'm not sure how long the tradition has run for or where it started, but it's been an ever annual amusement all my life. Newspapers, television, friends, family, communities all get in on the act to try to pull best pranks. In this case prankster wasn't me, but an impersonator who went to the length of register a [EMAIL PROTECTED] email account and then subscribing this account with osg-users, and then posted his/her announcement at plausible timing. As April 1st pranks go it was a pretty good one because it would be easy to just read it at face value before it sinks in that its April 1st and just a prank. So... the OpenSceneGraph hasn't really embraced MS technologies, its remains firmly fixed the world of open standards and any platform specifics will stay minimal and encapsulated as far as possible to prevent users being tied to any particular platform. This means that the OpenSceneGraph should still compile on Windows95 through to Vista, from now unsupported operating systems like IRIX to latest versions of Linux about to come out. Genuine standards provide continuity and portability which is which make it great for software that lives and useful life for a long time. Those who've been around the OpenSceneGraph community know that I'm a pretty outspoken supporter of open standards and portability. They'll also know that I don't personally go anywhere near Windows boxes, and certainly don't have much patience with Microsoft only technologies or its questionable business its practices. The prank was good because it reversed this all on its head, with a nod and wink to the current OOXML fiasco at ISO. So... the question is... who is the prankster Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Xiaodong Wu 吴晓东 'Xiao' means the time and the view when the sun rises and 'dong' means the east in Chinese ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph-2.3.7 dev release tagged.
How could the community do when the next Microsoft Technologies, such as DirectX changes like OS changes from Win95 to WinXp. On Wed, Apr 2, 2008 at 5:37 AM, Robert Osfield [EMAIL PROTECTED] wrote: One more thing... In the light of the recent efforts from Microsoft to support standards and for opening their source code. I've been thinking of making this one the last release before tagging in 2.4 next week or so. Then I will be starting to move OpenSceneGraph from exclusive OpenGL support to support also DirectX natively. Yes I know ... But that's not all, here is the list of features that 3.0 will bring : - fully written in C#, .NET Framework 3.5 compliant - full support of Windows Presentation Foundation (WPF) to enable seemless graphical UI experience inside your 3D applications - MSDN class documentation for all hidden features available in compressed XHTML - new osgDB plugins that will support OOXML import/export that will replace OpenSceneGraph old ascii and binary formats - native Excel support to define complex Viewer configurations - native Word support to replace osgText - support for All Microsoft optical mouse buttons This will however not be possible without full commitment of the community and funding ! Make your voices heard now if you want to join the new era in open source computer graphics software soon to be industry. 2008/4/1, Robert Osfield [EMAIL PROTECTED]: Hi All, I have now tagged the OpenSceneGraph-2.3.7 developer release, details can be found at: http://www.openscenegraph.org/projects/osg/wiki/Downloads/DeveloperReleases * OpenSceneGraph-2.3.7, released on 1st April 2008. Changes include : new OpenFlight writer support and libcurl based http reader have been introduced, OpenThreads sources have now been moved directly into the OpenSceneGraph SVN removing the old use of svn:externals, and various bug and build fixes. source package : OpenSceneGraph-2.3.7.zip svn tag: svn co http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags/OpenSceneGraph-2.3.7 OpenSceneGraph That's all folks :-) Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org Robert. the other :-) ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Xiaodong Wu 吴晓东 'Xiao' means the time and the view when the sun rises and 'dong' means the east in Chinese ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Help! Some error in my scene, but I don't how to fix it.
The error could be caused by the wrong triangle normals. Thanks all the same. Xiaodong 2008/3/31 Robert Osfield [EMAIL PROTECTED]: HI Xiaodong Wu Without more information one can't say what the problem might be. Is it the black triangles that you weren't expecting? If so then it's probably the source data/the data import/ or your model construction that is at fault, this type of issue is unlikely to be actual OSG problem unless there is a bug in one of the loaders. Robert. 2008/3/31 Wu Xiaodong [EMAIL PROTECTED]: Hi. I got some error in my scene, I snap the screen. which is attached. I load a triangle mesh into my scene, then the error was caused. I try to disable the culling by the code..-setCullingActive( 0 ); , which cannot fix the error, I need help, for i don't know how it was caused, and how to fix it. Thanks. Xiaodong Wu --- Xiaodong Wu 吴晓东 'Xiao' means the time and the view when the sun rises and 'dong' means the east in Chinese ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- Xiaodong Wu 吴晓东 'Xiao' means the time and the view when the sun rises and 'dong' means the east in Chinese ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] hello,I have a problem.
Hello. Niu: You need to set the class niuhm : public osg::Drawable::UpdateCallback object to your node to update; by: geom-setDataVariance( ); geom-setUpdateCallback( ); You can refer to the osgcallback in the osgExamples. xiaodong 2008/3/19 Niuheming [EMAIL PROTECTED]: Hi, I want to write a class from osg::Drawable::UpdateCallback to update a Geometry call named geom,but there is no update happen.I dot't know what's wrong.Does someone knows? Thanks in advance! NiuHeming class niuhm : public osg::Drawable::UpdateCallback { public: niuhm(const osg::Vec3 v11,const osg::Vec3 v22,const osg::Vec3 v33) { v1=v11; v2=v22; v2=v33; bs.radius()*=1.5f; bs=osg::BoundingSphere(osg::Vec3(0.0f,0.0f,0.0f),4.0f); bb.expandBy(bs); } nbsp ;virtual void update(osg::NodeVisitor* nv, osg::Drawable* node) { osg::Geometry* geom = dynamic_castosg::Geometry*(node); const osg::FrameStamp* frameStamp = nv-getFrameStamp(); if (geom frameStamp) { osg::PositionAttitudeTransform* mt = new osg::PositionAttitudeTransform(); { // set up the animation path osg::AnimationPath* animationPath = new osg::AnimationPath; animationPath-insert(0.0 ,osg::AnimationPath::ControlPoint(bb.corner(0))); animationPath-inse rt(1.0 ,osg::AnimationPath::ControlPoint(bb.corner(1))); animationPath-insert(2.0 ,osg::AnimationPath::ControlPoint(bb.corner(2))); animationPath-insert(3.0 ,osg::AnimationPath::ControlPoint(bb.corner(3))); animationPath-insert(4.0 ,osg::AnimationPath::ControlPoint(bb.corner(0))); animationPath-setLoopMode(osg::AnimationPath::SWING); nbs p; mt-setUpdateCallback(new osg::AnimationPathCallback(animationPath)); } // create marker for point light. osg::Vec3 vertices = mt-getPosition(); unsigned int noXSteps = 100; unsigned int noYSteps = 100; osg::Vec3Array* coords = new osg::Vec3Array; coords-reserve(noXSteps*noYSteps); osg::Vec3 dx = (v2-v1)/((float)noXSteps-1.0f); nbs p;osg::Vec3 dy = (v3-v1)/((float)noYSteps-1.0f); unsigned int rowvertices; unsigned int colvertices; rowvertices=(unsigned int)((vertices._v[0])/(dx._v[0])); colvertices=(unsigned int)((vertices._v[1])/(dy._v[1])); unsigned int row; nbsp; osg::Vec3 vRowStart = v1; for(row=0;rownoYSteps;++row){ osg::Vec3 v = vRowStart; for(unsigned int col=0;colnoXSteps;++col){ if ((row==rowvertices)(col==colvertices)) coords-push_back(v+osg::Vec3(0.0f,0.0f ,-1.0f)); else coords-push_back(v); v += dx; } vRowStart+=dy; } geom-setVertexArray(coords); } } osg::Vec3 v1; osg::Vec3 v2; osg::Vec3 v3; osg::BoundingSphere bs; osg::BoundingBox bb; }; -- 七件武器,七种完美 立刻体验! http://get.live.cn ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- 吴晓东 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] how to update the Camera
Hi, Robert: is there any limit on calling setHomePosition and computeHomePosition()? I have taken a try, but it didn't works. xiaodong On Mon, Mar 3, 2008 at 5:23 PM, Robert Osfield [EMAIL PROTECTED] wrote: Hi Xiaodong, Could it be that you are looking for the camera manipulator setHomePosition or computeHomePosition method? i.e. viewer.getCamaraManipulator()-setHomePosition(...); Robert. On Mon, Mar 3, 2008 at 2:35 AM, Wu Xiaodong [EMAIL PROTECTED] wrote: Hi, I am freshman in OpenSceneGrapph. Now I have some issue on updating the Camera when the Geode under it was updated. the details of the issue is as following. 1st step. I build a viewer and its scene graph with only one osg::Geometry which contains nothing. and set a TrackballManipulator to the viewer's camera; osg::ref_ptrosgGA::TrackballManipulator trackBall = new osgGA::TrackballManipulator; setCameraManipulator( trackBall.get() ); 2nd step. I update the one Geometry by a object of the class derived from the Geometry node's UpdateCallBack class; the default track ball center seems to be the (0,0,0); when the Gemetry is updated, the Geometry node's center is changed into (x0,y0,z0); but the track ball rotate around the vertex ( 0,0,0). How can I make it rotate around the (x0,y0,z0 ); I read the OSG's reference docs, may I can achieve it by setPreDrawCallback (DrawCallback *cb) . Is there any advice about the application above, Thanks. Xiaodong Wu ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- 吴晓东 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] how to update the Camera
Hi Robert: Thank you very much. I mean *do nothing at all*, and I solve also the problem by calling the *home(); *The OpenSceneGraph is great. xiaodong On Thu, Mar 6, 2008 at 5:10 PM, Robert Osfield [EMAIL PROTECTED] wrote: 2008/3/6 Wu Xiaodong [EMAIL PROTECTED]: Hi, Robert: is there any limit on calling setHomePosition and computeHomePosition()? I have taken a try, but it didn't works. What do you mean by it didn't work, did it do the wrong thing, did it do nothing at all? These methods just set the home position of the camera manipulator, they don't actual change the current view, to do this you need to call home() on the viewer or camera manipulator. Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- 吴晓东 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] how to update the Camera
Hi, I am freshman in OpenSceneGrapph. Now I have some issue on updating the Camera when the Geode under it was updated. the details of the issue is as following. 1st step. I build a viewer and its scene graph with only one osg::Geometry which contains nothing. and set a TrackballManipulator to the viewer's camera; *osg::ref_ptrosgGA::TrackballManipulator trackBall = new osgGA::TrackballManipulator; setCameraManipulator( trackBall.get() ); * 2nd step. I update the one Geometry by a object of the class derived from the Geometry node's UpdateCallBack class; the default track ball center seems to be the (0,0,0); when the Gemetry is updated, the Geometry node's center is changed into (x0,y0,z0); but the track ball rotate around the vertex ( 0,0,0). How can I make it rotate around the (x0,y0,z0 ); I read the OSG's reference docs, may I can achieve it by setPreDrawCallbackfile:///E:/Oil/OpenSceneGraphReferenceDocs/a01059.html#a76( DrawCallback file:///E:/Oil/OpenSceneGraphReferenceDocs/a01061.html *cb) . Is there any advice about the application above, Thanks. Xiaodong Wu ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] STL vectors and function calls
*MyIterator-AnotherMethod(); should be MyIterator-AnotherMethod(); On Dec 30, 2007 12:47 AM, Renan Mendes [EMAIL PROTECTED] wrote: Hi, everyone. I've got quick question on STL vectors. I've created a class (let's call it MyClass) with the method 'bool MyMethod(std::vectorMyClass MyVector)' that calls another method 'void AnotherMethod()' that makes a simple check on a variable inherent to every instance of MyClass. How do I write that method? Or better put: how do I change the following code to make it right? bool MyClass::MyMethod(std::vectorMyClass MyVector) { std::vectorMyClass::iterator MyIterator; for(MyIterator = MyVector.begin(); MyIterator != MyVector.end(); MyIterator++) { *MyIterator-AnotherMethod(); } } I read that an iterator was a pointer to the content of the vector, why doesn't it work? Thanks, Renan M Z Mendes ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- 吴晓东 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to enable the auto-rotate affect on a TrackballManipulator, ( win32mfc )
Hi, Everyone: I am a total begginer user of OSG for 3 days. How can i enable the auto-rotate effect on a TrackballManipulator? I have attached a osgViewer::viewer to a window on Win32.( windiow+MFC ) by following code. * viewer = new osgViewer::Viewer; osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = 0; traits-y = 0; traits-width = rc.Width(); traits-height = rc.Height(); . / osg::ref_ptrosgViewer::GraphicsWindowWin32::WindowData wdata = new osgViewer::GraphicsWindowWin32::WindowData( GetSafeHwnd() ); traits-inheritedWindowData = wdata.get(); osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if ( gc.valid() ) { viewer-getCamera()-setGraphicsContext(gc.get()); viewer-getCamera()-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); } /// viewer-setSceneData( createGeode().get() ); viewer-setCameraManipulator(new osgGA::TrackballManipulator); viewer-addEventHandler(new osgViewer::StatsHandler); viewer-realize(); // * but I cannot enable the Node viewer to auto-rotate just as the demos in the tutorial on site of www.openscenegraph.orgon the events of mouseButtonPress(x,y,1) or mouseButtonPress(x,y,3) and mouseButtonRelease(x,y,1) or mouseButtonRelease(x,y,3). what's the problem in the code? Thanks! xiaodong -- xiaodong Wu. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to enable the auto-rotate affect on a TrackballManipulator, ( win32mfc )
Hi. Robert. Thanks for ur respond, I have read the code osgAnimation. I used some confused word to describe my problem. ( :( bad English, my native laguage is Chinese ). What i want to know is that how the camera can go along its latest way(or path), For example, I drag the focus of camera ( trackball-manipulator ) from left to right on a window, then the camera should go around the trackball of the scene from a position to anothion. when I release the button, the camera can continue along its latest way( or path ) at a speed. when i drag from right to left, the camera go reversely and can go along with its new path. I failed to enable the camera continue along its latest way. when i release the button, the scene ceased, too. Thanks. xiaodong On Nov 22, 2007 5:42 PM, Robert Osfield [EMAIL PROTECTED] wrote: Hi Xiaodong, The TrackballManipulator is just for user interaction with the camera position, its does support throwing which is activated by the user releasing a mouse button while still moving the mouse. It sounds like this is not what you want though. To general rotate objects in the scene the way to do is to place a Transform node of some type (i.e. osg::MatrixTransform/PositionAttitudeTransform) and then attached an osg::AnimationPathCallback to it, or to attach a osgUtil::TransformCallback the later is deprecated though. With an AnimationPath you can define any combination of scaling, rotation and translation. Have a look at the osganimation example. Robert. On Nov 22, 2007 9:34 AM, Wu Xiaodong [EMAIL PROTECTED] wrote: Hi, Everyone: I am a total begginer user of OSG for 3 days. How can i enable the auto-rotate effect on a TrackballManipulator? I have attached a osgViewer::viewer to a window on Win32.( windiow+MFC ) by following code. viewer = new osgViewer::Viewer; osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-x = 0; traits-y = 0; traits-width = rc.Width(); traits-height = rc.Height(); . / osg::ref_ptrosgViewer::GraphicsWindowWin32::WindowData wdata = new osgViewer::GraphicsWindowWin32::WindowData( GetSafeHwnd() ); traits-inheritedWindowData = wdata.get(); osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext( traits.get()); if ( gc.valid() ) { viewer-getCamera()-setGraphicsContext( gc.get()); viewer-getCamera()-setViewport(new osg::Viewport(0,0, traits-width, traits-height)); } /// viewer-setSceneData( createGeode().get() ); viewer-setCameraManipulator(new osgGA::TrackballManipulator); viewer-addEventHandler(new osgViewer::StatsHandler); viewer-realize(); // but I cannot enable the Node viewer to auto-rotate just as the demos in the tutorial on site of www.openscenegraph.orgon the events of mouseButtonPress(x,y,1) or mouseButtonPress(x,y,3) and mouseButtonRelease(x,y,1) or mouseButtonRelease(x,y,3). what's the problem in the code? Thanks! xiaodong -- xiaodong Wu. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- 吴晓东 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org