Re: [osg-users] G++ version problem
Good morning, On Monday 04 April 2011, Grahame Bowland wrote: `__sync_bool_compare_and_swap_4' src.cxx:(.text+0x78): undefined reference to `__sync_bool_compare_and_swap_4' collect2: ld returned 1 exit status gmake[1]: *** [cmTryCompileExec] Error 1 gmake: *** [cmTryCompileExec/fast] Error 2 It does seem the builtins are disabled. As Alberto said probably because they're not available for the default 32-bit compiler target, Here's the 'g++ -v' output: Using built-in specs. Target: i686-pc-linux-gnu Configured with: ./configure --prefix=/opt/gcc-4.4.3 --with-mpfr=/opt/mpfr-2.3.2 --enable-languages=c,c++,objc Thread model: posix gcc version 4.4.3 (GCC) There is a configure time switch in gcc that changes the default architecture. Distributions usually have their compiler configured for something that includes support for atomics. But your hand configured gcc uses the really conservative i386 (not i486, really 80386) default which did not have any smp support at this very old time. So either give -march=i686 or something sensible for your project to the c and c++ flags when doing the cmake configure step. Or rebuild gcc with the configure flag --with-cpu=i686 or something sensible for your build environment. Then rebuild osg from scratch. Greetings Mathias -- Dr. Mathias Fröhlich, science + computing ag, Software Solutions Hagellocher Weg 71-75, D-72070 Tuebingen, Germany Phone: +49 7071 9457-268, Fax: +49 7071 9457-511 -- Vorstand/Board of Management: Dr. Bernd Finkbeiner, Dr. Roland Niemeier, Dr. Arno Steitz, Dr. Ingrid Zech Vorsitzender des Aufsichtsrats/ Chairman of the Supervisory Board: Michel Lepert Sitz/Registered Office: Tuebingen Registergericht/Registration Court: Stuttgart Registernummer/Commercial Register No.: HRB 382196 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG 2.8.4 VS2010 build problem DLL versioning
Hi all, Paul did some digging, and thinks that maybe this trunk patch: http://www.openscenegraph.org/projects/osg/changeset/11904 Might have been the fix for this. This appears to have been the work of Sukender and Wang Rui. I've copied them on this. Maybe they can tell us if this is the magic fairy dust we need in order to make 2.8.x build properly on VS2010. This patch seems to be too old and do not match the actual sources... (on 2.8.4 ) I was not able to apply it. Sorry but I'm not (yet) a CMake master so I can't create a patch myself. If anyone can help us fixing this ... Thanks. Regards, Vincent. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] G++ version problem
Hi Mathias, Grahame, Mathias Fröhlich writes: Good morning, On Monday 04 April 2011, Grahame Bowland wrote: `__sync_bool_compare_and_swap_4' src.cxx:(.text+0x78): undefined reference to `__sync_bool_compare_and_swap_4' collect2: ld returned 1 exit status gmake[1]: *** [cmTryCompileExec] Error 1 gmake: *** [cmTryCompileExec/fast] Error 2 It does seem the builtins are disabled. As Alberto said probably because they're not available for the default 32-bit compiler target, Here's the 'g++ -v' output: Using built-in specs. Target: i686-pc-linux-gnu Configured with: ./configure --prefix=/opt/gcc-4.4.3 --with-mpfr=/opt/mpfr-2.3.2 --enable-languages=c,c++,objc Thread model: posix gcc version 4.4.3 (GCC) There is a configure time switch in gcc that changes the default architecture. Distributions usually have their compiler configured for something that includes support for atomics. But your hand configured gcc uses the really conservative i386 (not i486, really 80386) default which did not have any smp support at this very old time. So either give -march=i686 or something sensible for your project to the c and c++ flags when doing the cmake configure step. Or rebuild gcc with the configure flag --with-cpu=i686 or something sensible for your build environment. Then rebuild osg from scratch. I agree; if you are only going to use that OSG version with the same computer or with another having the same or later CPU, maybe the easiest way is to use -march=native as I said earlier. If you are not sure about what kind of processors are going to run the code, you'll have to find a common base architecture like the one suggested by Mathias, -march=i686. There is a comprehensive list at http://gcc.gnu.org/onlinedocs/gcc-4.4.5/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options Again, please note that this will enforce a constraint on the minimum CPU requirement for the systems running your software. -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] G++ version problem
On Mon, 2011-04-04 at 09:33 +0200, Alberto Luaces wrote: Hi Mathias, Grahame, Mathias Fröhlich writes: There is a configure time switch in gcc that changes the default architecture. Distributions usually have their compiler configured for something that includes support for atomics. But your hand configured gcc uses the really conservative i386 (not i486, really 80386) default which did not have any smp support at this very old time. So either give -march=i686 or something sensible for your project to the c and c++ flags when doing the cmake configure step. Or rebuild gcc with the configure flag --with-cpu=i686 or something sensible for your build environment. Then rebuild osg from scratch. I agree; if you are only going to use that OSG version with the same computer or with another having the same or later CPU, maybe the easiest way is to use -march=native as I said earlier. If you are not sure about what kind of processors are going to run the code, you'll have to find a common base architecture like the one suggested by Mathias, -march=i686. There is a comprehensive list at http://gcc.gnu.org/onlinedocs/gcc-4.4.5/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options Again, please note that this will enforce a constraint on the minimum CPU requirement for the systems running your software. We can definitely assume people running our software have an i686 (and we could probably assume SSE2 as well.) We're building our own stack of libraries (glib, gtk, pango, openscenegraph, ...) that allows us to ship our software to people running very old Linux distributions like RHEL4. Unfortunately I've already shipped several versions of my program that depend on the openscenegraph library which was miscompiled without atomic support. I've patched the test so that it always fails, which solves my problem for now. Thanks for everyone's help! Cheers Grahame ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Site localization equations for RTK GPS
Hi, On 02/04/11 19:09, Brett wrote: Hi, I was wondering if any of the equations or libraries used with osg or vpb allow the user to perform site calibration / localization for RTK GPS. ie. I am trying to create a transform to convert WGS84 coordinates into a local Cartesian coordinate system based on matching 3 or more GPS survey points with locally defined / measured points. The local points are in a localized 'flat' coordinate system. This may require calculating a local 'datum' using something like a Molodensky or Bursa-Wolf transform. I am looking for information to develop these equations or some open-source software to perform this calculation. Any help or advice is greatly appreciated. Thanks in advance. OSG's EllipsoidModel can do some of this for you. See: computeLocalToWorldTransformFromLatLongHeight Basically you create a transform like this for a reference lat/long/alt point. This transform puts LLA points into a coordinate system on a local tangent plane (google this) at the reference point. In the local system you can then align your device axes/coordinate system to the reference axes/coordinate system by using multiple points and some optimisation algorithm. So, in one direction you go from LLA - ECEF - local coords - device coords. cheers jp Brett ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html. This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [osgPlugins] Convert DAE animation into IVE (or OSG)
Hi, is there a way to convert DAE animation into IVE (or OSG)? I try with osgconv but it seems that the result isn't animated. Thank you! daniele -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38196#38196 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] Cross Compile OpenThreads
Hi, Thanks for that information, I have got a bit further now with the help of your link. I used ccmake to configure the CMakeLists.txt. I find that I can cross compile OpenThreads but not the rest of the OSG, which is as you suggest. Our code includes from the build machine install locations rather than the OSG build location so I guess I need to run a make install on my OSG with openthreads cross-compiled. However this does not actualy seem to update the OpenThreads files in /usr/include or usr/local/include. Cheers, Peter -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38197#38197 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] Cross Compile OpenThreads
Hi Peter, Peter Watson writes: Hi, Thanks for that information, I have got a bit further now with the help of your link. I used ccmake to configure the CMakeLists.txt. I find that I can cross compile OpenThreads but not the rest of the OSG, which is as you suggest. Our code includes from the build machine install locations rather than the OSG build location so I guess I need to run a make install on my OSG with openthreads cross-compiled. However this does not actualy seem to update the OpenThreads files in /usr/include or usr/local/include. Yes -- the install target depends on all the rest of OSG, so you would need to compile it first. However, you can tweak the building system to bypass that issue: open src/CMakeLists.txt and, in the line reading FOREACH, erase all lines except for the OpenThreads one. That way you could make use of the install target. The other way is to manually copy the files from your build directory. -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgDB ifstream / ofstream conflict
Hi all, I've an issue concerning the std::ifstream in my application. I know that I need to use osgDB::ifstream instead of std::ifstream and I did everywhere in my code. But, my project links with an other lib than OSG, and this library is using std::ifstream and std::ofstream, and this results in thing like that (using VS2010 and OSG 2.8.3) : 2TsLib_MDdNET2010.lib(IwPoly.obj) : error LNK2005: public: void __thiscall std::basic_ifstreamchar,struct std::char_traitschar ::close(void) (?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in osgDBd.lib(osg65-osgDBd.dll) 2TsLib_MDdNET2010.lib(IwBrepData.obj) : error LNK2005: public: void __thiscall std::basic_ifstreamchar,struct std::char_traitschar ::close(void) (?close@?$basic_ifstream@DU?$char_traits@D@std@@@std@@QAEXXZ) already defined in osgDBd.lib(osg65-osgDBd.dll) Do you have any suggestion to fix this issue ? Thanks for your help, Regards, Vincent. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Y up to Z up
Hi, I'm back again! I have been looking at the ogre example code, and I've noticed that initializes the bones with a specific angle... Code: void setupBone(const String name,const Ogre::Quaternion q) { Ogre::Bone* bone = mBodyEnt-getSkeleton()-getBone(name); bone-setManuallyControlled(true); bone-setInheritOrientation(false); bone-resetOrientation(); bone-setOrientation(q); bone-setInitialState(); } void setupAnimations() { // this is very important due to the nature of the exported animations mBodyEnt-getSkeleton()-setBlendMode(ANIMBLEND_CUMULATIVE); String animNames[] = {IdleBase, IdleTop, RunBase, RunTop, HandsClosed, HandsRelaxed, DrawSwords, SliceVertical, SliceHorizontal, Dance, JumpStart, JumpLoop, JumpEnd}; //set all to manualy controlled //Ogre::Bone* handleLeft = mBodyEnt-getSkeleton()-getBone(Hand.L); //handleLeft-setManuallyControlled(true); //Ogre::Matrix3 mat; Ogre::Quaternion q = Quaternion::IDENTITY; Quaternion q2,q3; Vector3 xAxis,yAxis,zAxis; q.FromAngleAxis(Ogre::Degree(90),Vector3(0,0,-1)); q.ToAxes(xAxis,yAxis,zAxis); q2.FromAngleAxis(Ogre::Degree(90),xAxis); setupBone(Humerus.L,q*q2); q.FromAngleAxis(Ogre::Degree(90),Vector3(0,0,1)); q.ToAxes(xAxis,yAxis,zAxis); q2.FromAngleAxis(Ogre::Degree(90),xAxis); setupBone(Humerus.R,q*q2); q.FromAngleAxis(Ogre::Degree(90),Vector3(0,0,-1)); q2.FromAngleAxis(Ogre::Degree(45),Vector3(0,-1,0)); setupBone(Ulna.L,q*q2); q.FromAngleAxis(Ogre::Degree(90),Vector3(0,0,1)); setupBone(Ulna.R,q*q2.Inverse()); q.FromAngleAxis(Ogre::Degree(180),Vector3(0,1,0)); setupBone(Chest,q); setupBone(Stomach,q); q.FromAngleAxis(Ogre::Degree(180),Vector3(1,0,0)); q2.FromAngleAxis(Ogre::Degree(180),Vector3(0,1,0)); setupBone(Thigh.L,q*q2); setupBone(Thigh.R,q*q2); setupBone(Calf.L,q*q2); setupBone(Calf.R,q*q2); setupBone(Root,Degree(0),Degree(0),Degree(0)); In principle, I dont understand it... This is done to redirect the bones? If we orient correctly from a model editor(maya,blender), we wouldnt need to do this, right? In the model of sinbad for example, the Root bone is oriented with X up. Doing this, setupBone(Root,Degree(0),Degree(0),Degree(0)); will change anything? [Image: http://img577.imageshack.us/img577/2/sinbadn.jpg ] First I will review the orientation of the bones of my models ... and I will publish results ... Thank you! Cheers, Aitor -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38200#38200 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] CMake - How to configure a library using OSG
Hi everybody, I'm working a library as a toolbox based on OSG. I'm trying to write a CMake configuration file. The file is working, OSG is found, but OSG needs two includes directories : D:\Codage\OSG_2.8.2\binaries\include; D:\Codage\OSG_2.8.2\sources\src\include; And Cmake generate a Visual Studio 2008 project with only the sources/src/include directory... so the project do not compil. How can I change that to have the good include directories ? I join my CmakeLists.txt configuration file, if it can help Thanks for your help. Regards, Vincent. cmake_minimum_required(VERSION 2.6) #set the name of the project SET(LIBRARYNAME Hud) #Déclaration du projet project(${LIBRARYNAME}) #Repertoire de sortie des compilations set(LIBRARY_OUTPUT_PATH lib) #inclusion d'OSG et OpenThreads FIND_PACKAGE(OpenThreads) FIND_PACKAGE(OpenSceneGraph 2.8.0 REQUIRED QUIET COMPONENTS osg osgDB osgUtil osgGA osgText osgFX osgViewer) #ajout des includes des libs dans les paths d'include include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}) include_directories(${OPENTHREADS_INCLUDE_DIRS}) #Do not forget its own includes include_directories(src) #Génération de la liste des fichiers header file( GLOB_RECURSE header_source_files src/*.h ) #Génération de la liste des fichiers cpp file( GLOB_RECURSE cpp_source_files src/*.cpp ) #Déclaration de la lib add_library( ${LIBRARYNAME} SHARED ${cpp_source_files} ${header_source_files} ) #ajout des libs au linker target_link_libraries( ${LIBRARYNAME} ${OPENTHREADS_LIBRARIES} ${OPENSCENEGRAPH_LIBRARIES} ) ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Work In Progress Paper Call for 2011 Summer Simulation Multiconference
Hello, There is a Computer Graphics for Simulation Track at the SCSC'11 conference and the conference attracts other graphics papers. The track has Simulation / X3D, WebGL and Scenegraph themes, so if you did not make the Web3D conference feel free to submit to the general WIP track. I know of one OSG paper that was submitted. Anyone want to make it 2. Or 3 or 10 or 100? WIP is your potential venue. Although this is call is for the WIP track for the multi-conference, I also encourage people to attend the conference if you are in Europe. It is a multi-conference and for the attendance fee you can attend SCSC'11 and other participating conferences [GCMS (sort of a supercomputer for Simulation conference), a telecommunications conference (SPECTS) and SISO's interoperability workshop]. CALL FOR WORK-IN-PROGRESS PAPERS = 2011 SUMMER SIMULATION MULTICONFERENCE (SUMMERSIM 2011) http://www.scs.org/summersim/2011 June 27 - 30, 2011, World Forum, The Hague, Netherlands The purpose of this conference is to provide a forum to discuss recent advances in various aspects and applications of MS, which are addressed by focus areas of each of the conference within this multi-conference. The multiconference bridges various areas of modeling and simulation ranging from theory, methodology, and applications to verification and analysis, and the challenges involved in the process into a single exciting venue for the interchange of ideas and scientific discussion and education. Please submit the advanced but not fully developed results of your research for review by the technical program members of each conference using the following URLs: SCSC: http://www.softconf.com/scs/SCSC11/ SPECTS: http://www.softconf.com/scs/SPECTS11/ GCMS: http://www.softconf.com/scs/GCMS11/ The length of the Work-in-Progress papers is up to 6 pages in final conference format. All the papers of this conference will be included in the conference proceedings and the presented papers will be archived in the ACM Digital Library for the SCSC and GCMS papers or in IEEE Xplore for the SPECTS papers. Important Dates === Paper Submission: April 22 2011 Notification: May 13 2011 Camera-Ready Paper: May 27 2011 SummerSim 2011 Organizing Committee === General Chair: Hamid Vakilzadian, University of Nebraska-Lincoln, USA General Vice Chair: Francesco Longo, University of Calabria, Italy SPECTS General Chair: Jose Sevillano, University of Seville, Spain SCSC General Chair: Peter Kropf, Université de Neuchâtel, Switzerland GCMS General Chair: Roy Crosbie, Californian State University Chico, USA Poster Track Chair: Abdolreza Abhari, Ryerson University, Canada Sponsored by The Society for Modeling and Simulation International, SCS in cooperation with ACM/SIGSIM for SCSC and GCMS Technical Co-Sponsorship with IEEE Communications Society (ComSoc) and IEEE SMC Society for SPECTS smime.p7s Description: S/MIME cryptographic signature ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] CMake - How to configure a library using OSG
On 4/4/2011 1:33 PM, Vincent Bourdier wrote: Hi everybody, I'm working a library as a toolbox based on OSG. I'm trying to write a CMake configuration file. If it's Open Source, you might look at existing libraries like osgWorks: http://code.google.com/p/osgworks/ And utilize the CMake infrastructure they already have worked out. -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting. There is no Truth. There is only Perception. To Perceive is to Exist. - Xen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] fbx animation
ok, now i have osg 2.9.11 and no longer mark error, but where i can specific my .fbx file?, i try to find it, but I could not -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38204#38204 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [vpb] osgdem .asc file seems to build terrain backwards?
Hi, I have updated my gdal to openev with fwtoolkit, and redid the exercise of transforming the elevation data. Using OpenEV and doing the translation and a viewing in the tif format, I can see what I expect for my coastline. However, when I generate the terrain with osgdem using my new found tif, and view with osgviewer, I get a coastline that is 180 degrees out (mirrored in one direction). When I try to use a graphic editor to view the tif, it claims invalid image, and I thought it was supposed to be able to be viewed even as a geotiff. Does this only happen with .asc files? Any more thoughts? More cheers, tim -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38205#38205 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] dae plugin
Hi, I am currently trying to load http://o3d.googlecode.com/svn/trunk/googleclient/o3d_assets/samples/beachdemo/convert_assets/beachdemo.zip with the dae collada plugin but I have only a white scene in osgviewer. I am not familiar with the collada specification, so before digging it I would like to know if other people are working on this plugin and what is the state of the collada plugin related to the spec. Cheers, Cedric -- Provide OpenGL, WebGL and OpenSceneGraph services +33 659 598 614 Cedric Pinson mailto:cedric.pin...@plopbyte.com http://plopbyte.com signature.asc Description: This is a digitally signed message part ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] problem with PolytopeIntersector and double
Hi, i have point picking implemented which works fine when i store the data as osg::Vec3Array and set it in the geometry as geometry-setVertexArray(vec3_vertArr) But i choose to store it as a double, ie osg::Vec3dArray and set it in the geometry as geometry-setVertexArray(vec3d_vertArr) then point picking fails using the same PolytopeIntersector. below is a the code for detecting the intersections Code: void PickHandler::pick(osgViewer::View* view, const osgGA::GUIEventAdapter ea) { const float x = ea.getX(); const float y = ea.getY(); const float look_offSet = 10.0f; osg::ref_ptrosgUtil::PolytopeIntersector polyTopeIntersector = new osgUtil::PolytopeIntersector(osgUtil::Intersector::WINDOW, x - look_offSet , y - look_offSet, x + look_offSet, y + look_offSet ); polyTopeIntersector-setDimensionMask(osgUtil::PolytopeIntersector::DimZero); // only pick points osgUtil::IntersectionVisitor iv( polyTopeIntersector ); view-getCamera()-accept( iv ); if (polyTopeIntersector-containsIntersections()) // some hits where found! { ... } } Whats the solution? -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38208#38208 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] fbx animation
I've made a model in 3Ds Max 2011 and animated it. After seeking help I was told to re-export the model, cooking the animations into the .fbx file. My problem now is that I don't know how to access the animations within Visual Studio/XNA in order to play them as my character walks/runs.. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38209#38209 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] OSG - MFC - can't get key press
I am working with a MFC based OSG application. I can get the viewer up with a model displayed and I can move it around with the mouse. I have added a variety of events including the StatsHandler. I want to use keboard inputs as they are used in the osgViewer application but I can not get any of the OnKeyDown or OnChar callbacks to pass into osg key press function. The spacebar and ESC keys close the window and those are the only keys that appear to do anything. I used the osg MFC example as the base to my application on windows XP and on windows 7 with OSG version 2.8.3 . Is there any way to get the other functions to work with an MFC-OSG application in particular 'f' for full size, 's' for statistics and spacebar to reset the model's position. Thanks for your help Bruce This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address.___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osg::Node and Bullet Physic
Hi I made my own osg::Node (osg::Group) with Physics. This works great if i insert the node on position (0,0,0) If i made a positionattitudeTransform with the physics-Node the node is on the new position but the physics-Node / Object is still at 0,0,0 here is the code: h-File: Code: class PhysicsCube : public osg::Group { public: PhysicsCube(); ~PhysicsCube(void); osg::MatrixTransform* createNode(double length, double mass, btDynamicsWorld* dynamicsWorld, osg::Vec3d position); void setColor(osg::Vec4d color); btRigidBody *getBody(void); private: void createGeometry(void); osg::ShapeDrawable* _boxDrawable; double _length; double _mass; btDynamicsWorld* _dynamicsWorld; btRigidBody* _body; }; class BallUpdateCallback : public osg::NodeCallback { private: btRigidBody *_body; public: BallUpdateCallback(btRigidBody *body) : _body(body) {} virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) { btScalar m[16]; btDefaultMotionState* myMotionState = ( btDefaultMotionState*)_body-getMotionState(); myMotionState-m_graphicsWorldTrans.getOpenGLMatrix(m); double t = nv-getFrameStamp()-getReferenceTime(); osg::Matrix mat = osg::computeLocalToWorld(nv-getNodePath()); //osg::Matrixf mat(m); osg::PositionAttitudeTransform *pat = dynamic_castosg::PositionAttitudeTransform *(node); pat-setPosition(mat.getTrans()); pat-setAttitude(mat.getRotate()); I3D_LOG(notification) mat.getTrans().x() , mat.getTrans().y() , mat.getTrans().z() std::endl; traverse(node, nv); } }; cpp: Code: osg::MatrixTransform* PhysicsCube::createNode(double length, double mass, btDynamicsWorld* dynamicsWorld, osg::Vec3d position) { _length = length; _mass = mass; _dynamicsWorld = dynamicsWorld; position = osg::Vec3d(0,0,0); // OSG CODE osg::ref_ptr osg::MatrixTransform node = new osg::MatrixTransform; osg::Geode* geodeBox = new osg::Geode(); osg::Box* box = new osg::Box(position, _length ); _boxDrawable = new osg::ShapeDrawable(box); _boxDrawable-setColor(osg::Vec4d(0.5, 0.5, 1.0, 1.0)); geodeBox-addDrawable(_boxDrawable); node-addChild(geodeBox); // OSGBBULLET CODE osgbBullet::MotionState * motion = new osgbBullet::MotionState; motion-setTransform( node.get() ); btCollisionShape * collision = osgbBullet::btConvexTriMeshCollisionShapeFromOSG( node.get() ); // BULLET CODE btTransform bodyTransform; bodyTransform.setIdentity(); bodyTransform.setOrigin( btVector3( 0, 0, 0 ) ); motion-setWorldTransform( bodyTransform ); btScalar objectMass( mass ); btVector3 inertia; collision-calculateLocalInertia( objectMass, inertia ); btRigidBody::btRigidBodyConstructionInfo rbinfo( objectMass, motion, collision, inertia ); _body = new btRigidBody( rbinfo ); // body-setLinearVelocity( btVector3( -5, -1, 0 ) ); // body-setAngularVelocity( btVector3( 1, 0, 0 ) ); dynamicsWorld-addRigidBody(_body ); return( node.release() ); } void PhysicsCube::createGeometry(void) { } void PhysicsCube::setColor( osg::Vec4d color ) { _boxDrawable-setColor(color); } btRigidBody * PhysicsCube::getBody( void ) { return _body; } I use the physicsCube like this: Code: _cNode = new I3DENGINE::Physics::PhysicsCube; osg::PositionAttitudeTransform *temp = new osg::PositionAttitudeTransform; temp-addChild(_cNode-createNode(length, mass, dynamicsWorld, position)); temp-addChild(_sNode); temp-setPosition(osg::Vec3d(0,0,100)); // - does not work correctly temp-setUpdateCallback(new I3DENGINE::Physics::BallUpdateCallback(_cNode-getBody())); return temp; What has to be changed so that the node's position will be updated according to the physic's node location? Sorry for my bad english! Thank you! Cheers, Marco -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38211#38211 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org