Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment
I stumbled on this thread when working on a similar problem that I had using IntersectionVisitor in Visual Studio projects. I just wanted to confirm that I have found that the OSG examples and OSGHelp examples that utilized IntersectionVisitor crashed under Windows when utilizing the latest downloaded Visual Studio binaries. (I tried the exaples MouseSceneIntersection, osgpick and osgkeyboardmouse and could not get any of them to function) However, numerous other example apps are working in Visual Studio. Based on the previous posters response it appears that recompiling the Source within Visual studio is the method to address this problem. omartinaud wrote: Hi everybody, Finally, I decided to reinstall osg using the sources. I took the osg 2.8.3 sources and I compiled them using my version of visual studio. Now everything works perfectly ! Looks like I didn't have the good binaries. Thank you all for your help ! Cheers, Olivier -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29877#29877 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment
Hello Tim, Based on the previous posters response it appears that recompiling the Source within Visual studio is the method to address this problem. Err, no, usually just making sure you don't mix debug and release and that you use binaries for the same version of Visual Studio should make everything work. The previous poster was me, and I just confirmed that the OP was using VC9 (Visual Studio 2008) and the binaries they had downloaded were for VC8 (Visual Studio 2005). Of course, in their case there was no other option than compiling OSG from source, since there were no binaries for VC9 available at the time. It appears there still aren't, so if you use VC9 then you'll have to compile from source too. But saying that the solution to the problem above was recompiling from source is false. The solution was to use binaries for the same version of Visual Studio, which in this particular case implied compiling from source. It just means you have to know what you're downloading. If you see binaries for Visual Studio 8 and you're using Visual Studio 9, don't assume it will still work and then wonder why it crashes... Which version of Visual Studio are you using? Which version of Visual Studio are the binaries compiled for? What library files are you linking to? What configuration are you compiling your project in? J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment
Hi Tim, It just means you have to know what you're downloading. If you see binaries for Visual Studio 8 and you're using Visual Studio 9, don't assume it will still work and then wonder why it crashes... In fact, the download page even states it in underlined text... - Quote - Visual Studio users, make sure you download the binaries for your Visual Studio version: 8 (2005) or 9 (2008). You cannot link OSG libraries for VS8 into a VS9 executable or vice versa, they have to match. If you want to be really sure, download the source and compile OSG yourself. - http://www.openscenegraph.org/projects/osg/wiki/Downloads J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment
Bonjour Olivier, Actually I had tried IntersectionVisitor before. I had the same problem, which is why I switched to IntersectVisitor. You really need to send us a complete code example that reproduces your problem. That means one source file that contains a main() and which we can compile standalone to see if it works for us, and how we can make it work. Someone asked you before in this thread, but your answer was ambiguous: does the osgpick example work for you? Or does it crash? The fact your code is crashing on iterating over an stl container returned from OSG really points to you mixing release and debug. I know you checked already, but check again. If your app is being compiled in release, it needs to link to only release libs. If it's being compiled in debug, it needs to link to only debug libs. You said earlier in the thread that you link to only release libs, but is your app also being compiled in release, and against the /MD (Multi-threaded DLL) runtime? You can keep the debug libs installed (in fact you won't be able to debug even your own code if you don't) but you need to make sure your project and the libs it links to match in this regard. If you're not sure, send us the whole thing : code and Visual Studio project files. Hope this helps, J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment
Hi everybody, Finally, I decided to reinstall osg using the sources. I took the osg 2.8.3 sources and I compiled them using my version of visual studio. Now everything works perfectly ! Looks like I didn't have the good binaries. Thank you all for your help ! Cheers, Olivier -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=27973#27973 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment
Bonjour Olivier, Finally, I decided to reinstall osg using the sources. I took the osg 2.8.3 sources and I compiled them using my version of visual studio. Now everything works perfectly ! Good to know you got it solved. Looks like I didn't have the good binaries. Yes, I think Peter hit the nail on the head. When using Visual Studio it's really important to make sure everything matches correctly... It can be a pain, and everyone wonders what MS was thinking of when they made the design and implementation decisions that led to this, but it's just something we have to live with if we want to use this tool. I added a note to the downloads page that the Visual Studio version needs to match between the OSG libraries and the app they're linked to. Hopefully that will make it clearer for others in the future. J-S -- __ Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.webhop.org/ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment
Hello, I checked the installation of osg. I was not mixing debug and release. But to be sure I uninstalled debug. However I still have the same probem as before. I copied the stack trace if it helps. Do you have any idea ? osg65-osg.dll!100042aa() [Les frames ci-dessous sont peut-être incorrects et/ou manquants, aucun symbole chargé pour osg65-osg.dll] osg65-osgUtil.dll!0048ad2c() OSGDefaultProject.exe!PickHandler::coordinates3D(int mouseX=264839480, int mouseY=509, int tailleFenetre=750, double angleVue=2.6388121119329419e-308, double k1=2.6388121119329419e-308, double k2=2.6388121119329419e-308, double k3=2.6388121119329419e-308, double k4=2.6388121119329419e-308, double k5=2.6388121119329419e-308) Ligne 88 C++ OSGDefaultProject.exe!PickHandler::handle(const osgGA::GUIEventAdapter ea=, osgGA::GUIActionAdapter aa=) Ligne 33 C++ osg65-osgGA.dll!0042854e() osg65-osgGA.dll!00421981() osg65-osgGA.dll!004219cc() osg65-osgViewer.dll!005b0727() ntdll.dll!7c91df5a() ntdll.dll!7c928b23() ntdll.dll!7c922d78() msvcr90.dll!785436c5() msvcr90.dll!785438b3() msvcr90.dll!785427b4() OSGDefaultProject.exe!pre_cpp_init() Ligne 326 + 0x27 octets C msvcr90.dll!78542201() OSGDefaultProject.exe!__tmainCRTStartup() Ligne 582 + 0x17 octets C kernel32.dll!7c816fe7() Thank you, Regards, Olivier -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=27921#27921 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment
Hi Oliver, Sorry to hear it wasn’t as simple... It could be a bug, but normally someone else would 'pipe up' and say that was fixed :) Does look like a problem with pickhandler, can you post some source code to recreate the problem? Have you tried the examples and do the work ok? Also you may want to provide some more details, such as compiler version, version of OS, OSG version in use (prebuilt or compiled from source). You may also want to try and compile the code against the latest SVN if you are using pre-built DLL's, see if that makes a difference. It looks like something is being referenced that has a NULL pointer, but I am still learning C++ and will be forever ;) Martin. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment
Hi, Thank you for your answer. Indeed, I installed both libraries, debug and release. I always compile my code in release mode (it compiles in debug mode but I don't know why the exe doesn't work then). I'll check on monday if both libraries are correctly and separately installed. Do you think it could cause the problem I have ? Cheers, Olivier -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=27856#27856 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment
Hi, Yes Windows doesn't like that or certain parts of it, such as anything that uses memory allocation. http://stackoverflow.com/questions/1227653/linking-against-library-in-releas e-and-exe-in-debug-crashes-in-visual-studio Have a look at the above. Of course it could be 1001 other things, but I guess this is the first place to start. Check your linker settings and make sure that you are linking against the correct versions. I did something the other day and linked my release version again osgd.lib instead of osg.lib and my release version was crashing. Also if you post the stack trace it may help find the problem? -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Olivier Martinaud Sent: 13 May 2010 12:53 To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment Hi, Thank you for your answer. Indeed, I installed both libraries, debug and release. I always compile my code in release mode (it compiles in debug mode but I don't know why the exe doesn't work then). I'll check on monday if both libraries are correctly and separately installed. Do you think it could cause the problem I have ? Cheers, Olivier -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=27856#27856 ___ 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] problem with osgUtil::IntersectVisitor and osg::LineSegment
Hi, I'm having some trouble implementing an intersection detection method. I have a model of a building and I'd like to get the coordinates of the intersection points between the model and a ray. I wrote the following code from osg samples online. osg::LineSegment *ls = new osg::LineSegment(osg::Vec3d(-5,-5,-5),osg::Vec3d(5,5,5)); osgUtil::IntersectVisitor *iv = new osgUtil::IntersectVisitor(); iv-addLineSegment(ls); iv-apply(*m_node); std::cout iv-getNumHits(ls) intersection points (hits). std::endl; //result = 6 osgUtil::IntersectVisitor::HitList hitlist = iv-getHitList(ls); std::cout size : hitlist.size() std::endl; //std::vectorosgUtil::Hit::iterator itr = hitlist.begin(); hitlist[0].getWorldIntersectPoint(); //causes unhandled exception... When I execute the code I have this error : unhandled exception at 0x100042aa in OSGDefaultProject.exe : 0xC005: access violation when reading 0xfeeeff36. The problem comes from the last line of the code (getWorldIntersectionPoint()). What's weird is that the iv finds 6 points of intersection, so the algorithm seems to work fine. But the size of my hitlist is abnormally large : it says more than 4 billion ! Thank you! Cheers, Olivier -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=27798#27798 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment
Hi Oliver, Are mixing debug and release libraries? Regards Martin. -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Olivier Martinaud Sent: 12 May 2010 14:33 To: osg-users@lists.openscenegraph.org Subject: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment Hi, I'm having some trouble implementing an intersection detection method. I have a model of a building and I'd like to get the coordinates of the intersection points between the model and a ray. I wrote the following code from osg samples online. osg::LineSegment *ls = new osg::LineSegment(osg::Vec3d(-5,-5,-5),osg::Vec3d(5,5,5)); osgUtil::IntersectVisitor *iv = new osgUtil::IntersectVisitor(); iv-addLineSegment(ls); iv-apply(*m_node); std::cout iv-getNumHits(ls) intersection points (hits). std::endl; //result = 6 osgUtil::IntersectVisitor::HitList hitlist = iv-getHitList(ls); std::cout size : hitlist.size() std::endl; //std::vectorosgUtil::Hit::iterator itr = hitlist.begin(); hitlist[0].getWorldIntersectPoint(); //causes unhandled exception... When I execute the code I have this error : unhandled exception at 0x100042aa in OSGDefaultProject.exe : 0xC005: access violation when reading 0xfeeeff36. The problem comes from the last line of the code (getWorldIntersectionPoint()). What's weird is that the iv finds 6 points of intersection, so the algorithm seems to work fine. But the size of my hitlist is abnormally large : it says more than 4 billion ! Thank you! Cheers, Olivier -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=27798#27798 ___ 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] problem with osgUtil::IntersectVisitor and osg::LineSegment
Sorry, Are you mixing debug and release libraries from OSG? Check you are linking with either all release or all debug. Martin -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Martin Naylor Sent: 12 May 2010 17:16 To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment Hi Oliver, Are mixing debug and release libraries? Regards Martin. -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Olivier Martinaud Sent: 12 May 2010 14:33 To: osg-users@lists.openscenegraph.org Subject: [osg-users] problem with osgUtil::IntersectVisitor and osg::LineSegment Hi, I'm having some trouble implementing an intersection detection method. I have a model of a building and I'd like to get the coordinates of the intersection points between the model and a ray. I wrote the following code from osg samples online. osg::LineSegment *ls = new osg::LineSegment(osg::Vec3d(-5,-5,-5),osg::Vec3d(5,5,5)); osgUtil::IntersectVisitor *iv = new osgUtil::IntersectVisitor(); iv-addLineSegment(ls); iv-apply(*m_node); std::cout iv-getNumHits(ls) intersection points (hits). std::endl; //result = 6 osgUtil::IntersectVisitor::HitList hitlist = iv-getHitList(ls); std::cout size : hitlist.size() std::endl; //std::vectorosgUtil::Hit::iterator itr = hitlist.begin(); hitlist[0].getWorldIntersectPoint(); //causes unhandled exception... When I execute the code I have this error : unhandled exception at 0x100042aa in OSGDefaultProject.exe : 0xC005: access violation when reading 0xfeeeff36. The problem comes from the last line of the code (getWorldIntersectionPoint()). What's weird is that the iv finds 6 points of intersection, so the algorithm seems to work fine. But the size of my hitlist is abnormally large : it says more than 4 billion ! Thank you! Cheers, Olivier -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=27798#27798 ___ 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