[osg-users] Scene.cpp deadlock
Hi, I found a deadlock in Scene.cpp. The problem exhibits itself when calling std::exit() instead of standard way of terminating of the application. The deadlock is seen on Windows only. On Linux, I get sigsegv or, at least, valgrind gives me info about using already freed memory. After the investigation, I found that the problem is using of static variables in getSceneCache() and getSceneCacheMutex() in Scene.cpp. The destructors of these static variables are registered by the compiler (gcc) using atexit() approach. (I could not believed it and made additional tests, but all the same.) As a result, the mentioned variables are destructed too early and before all global variables, resulting sigsegv and deadlocks... I moved the static variables to global scope and the problem disappeared. Is it the correct fix of the problem? Should I submit a patch? Comments? Ideas? John ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Scene.cpp deadlock
Hi Robert, I suspect this issue is down to the Scene object being destructed after the sceneCacheMutex and s_sceneCache are destructed Exactly. I managed to modify osgviewer app to exhibit this problem. I just moved viewer object from local scope to global and added std::exit(0); after viewer's construction. Valgrind reports following: ==15282== Invalid read of size 4 ==15282==at 0x5A99004: pthread_mutex_lock (pthread_mutex_lock.c:50) ==15282==by 0x656E199: OpenThreads::Mutex::lock() (PThreadMutex.cpp:130) ==15282==by 0x519CECF: OpenThreads::ScopedLockOpenThreads::Mutex::ScopedLock(OpenThreads::Mutex) (ScopedLock:31) ==15282==by 0x57DB40F: osgViewer::Scene::~Scene() (Scene.cpp:45) ==15282==by 0x57DB579: osgViewer::Scene::~Scene() (Scene.cpp:57) ==15282==by 0x52F486B: osg::Referenced::signalObserversAndDelete(bool, bool) const (Referenced.cpp:323) ==15282==by 0x403018: osg::Referenced::unref() const (Referenced:198) ==15282==by 0x580F250: osg::ref_ptrosgViewer::Scene::~ref_ptr() (in /usr/local/lib64/libosgViewerd.so.3.1.0) ==15282==by 0x57FEF7C: osgViewer::View::~View() (View.cpp:177) ==15282==by 0x581AEA8: osgViewer::Viewer::~Viewer() (Viewer.cpp:216) ==15282==by 0x581AFDF: osgViewer::Viewer::~Viewer() (Viewer.cpp:249) ==15282==by 0x52F486B: osg::Referenced::signalObserversAndDelete(bool, bool) const (Referenced.cpp:323) ==15282==by 0x403018: osg::Referenced::unref() const (Referenced:198) ==15282==by 0x4036F2: osg::ref_ptrosgViewer::Viewer::~ref_ptr() (in /usr/local/bin/osgviewerd) ==15282==by 0x6204820: __run_exit_handlers (exit.c:78) ==15282==by 0x62048A4: exit (exit.c:100) ==15282==by 0x402C62: main (osgviewer.cpp:48) ==15282== Address 0x92dc618 is 24 bytes inside a block of size 48 free'd ==15282==at 0x4C27FF2: operator delete(void*) (vg_replace_malloc.c:387) ==15282==by 0x656E267: OpenThreads::PThreadMutexPrivateData::~PThreadMutexPrivateData() (PThreadMutexPrivateData.h:38) ==15282==by 0x656E131: OpenThreads::Mutex::~Mutex() (PThreadMutex.cpp:115) ==15282==by 0x6204820: __run_exit_handlers (exit.c:78) ==15282==by 0x62048A4: exit (exit.c:100) ==15282==by 0x402C62: main (osgviewer.cpp:48) So, the mutex is already destructed when Scene is about to be destroyed. I guess the user should have the right to place osg::ref_ptr osgViewer::Viewer viewer; to the global scope, so the issue needs to be fixed. Ideas? Do you think moving static s_sceneCacheMutex and s_sceneCache of Scene.cpp into the global scope would be the proper fix? John On Monday 12 of March 2012 10:25:07 Robert Osfield wrote: Hi John, I suspect this issue is down to the Scene object being destructed after the sceneCacheMutex and s_sceneCache are destructed as both of these are constructed till after the first Scene object is constructed. To force these objects to be constructed first I think it is probably best to move the static s_sceneCacheMutex and s_sceneCache into the global scope to ensure they get created before the first Scene object ever gets created. Robert. On 12 March 2012 10:03, PC John pec...@fit.vutbr.cz wrote: Hi, I found a deadlock in Scene.cpp. The problem exhibits itself when calling std::exit() instead of standard way of terminating of the application. The deadlock is seen on Windows only. On Linux, I get sigsegv or, at least, valgrind gives me info about using already freed memory. After the investigation, I found that the problem is using of static variables in getSceneCache() and getSceneCacheMutex() in Scene.cpp. The destructors of these static variables are registered by the compiler (gcc) using atexit() approach. (I could not believed it and made additional tests, but all the same.) As a result, the mentioned variables are destructed too early and before all global variables, resulting sigsegv and deadlocks... I moved the static variables to global scope and the problem disappeared. Is it the correct fix of the problem? Should I submit a patch? Comments? Ideas? John ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g ___ 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] OpenSceneGraph performance drop between Qt 4.7 and 4.8
Hi Marco, I can not test it right now, but when Qt 4.8 will be made available with the new Ubuntu release in April, I will probably dig in the problem if I notice it on my application. John On Monday 12 of March 2012 11:10:51 Marco Fiocco wrote: I've even disabled the vsync but it does not improve the frame rate. You can verify this just by running osgViewerQt right away. Marco ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] light position through uniform
Hi, I want to place a light into the scene without using fixed pipeline. Thus, I created uniforms to pass light parameters to shaders. These works fine except light position and light direction. I want to pass light position in eye coordinates. I expect, I have to multiply light_local_position by local_to_world_matrix first, and then? I think, I should apply camera transformation as well, thus multiply it by perspective matrix as well, if I am not mistaken. Another problem follows: Can I store the the result (eyeCoordinateLightPosition) to the regular osg::Uniform while I am doing all above in the cull traversal? (I am worrying that the Uniform is added to rendering graph and the next frame cull traversal may modify the uniform before rendering graph is rendered, or is this scenario handled somehow?) Thanks for explanation or pointing me to the right path. John ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] best format for paged database
Thanks Brad, osga is really what I was looking for. It can store everything and it contains index, so the only overhead on open is to read the index (and not the whole file as with some other formats). I am going to try it. John On Thursday 08 of December 2011 20:20:16 Christiansen, Brad wrote: Hi, Just a comment regarding My initial wish was to have everything in one file.. You can achieve this by placing all you data into an archive format. I have used osga before and I have seen quite a bit of activity around the zip plugin recently. I ended up creating my own OSG archive based on SQLite but I havent managed to submit that code yet. One thing to note when using archives and PagedLODs, you have to make sure that rescources in sperate files are specified relative to the root of the archive, not relative to the loading file. I wrote a simple visitor to do this before adding all my data to the archive. Cheers, Brad ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] best format for paged database
Hi Torben and Xenon, I was studying OSG sources... (as usual way to study OSG) BTW: What are your performance requirements? Main requirement: I need to load base level geometry and base resolution textures ASAP, f.ex 1s. I will probably inline base-level texture data into the base-level scene database. Then, paging of geometry: Seems that high-res geometry need to stay in separate file, otherwise it would be loaded at start-up, slowing down the opening process, that has to complete in 1s. The last goal - to page in and page out textures depending on spatial proximity. The testing model is 72MB of jpegs and they take approximately 4.5GB when decompressed to memory while using several resolutions for each texture. What archtecture would you propose? I guess, I will need to place high-res textures to external files. And high-res geometry as well to avoid them being parsed on start-up and prolonging opening process. (My initial wish was to have everything in one file.) John On Wednesday 07 of December 2011 09:02:25 Chris 'Xenon' Hanson wrote: On 12/7/2011 12:29 AM, PC John wrote: Thanks Chris and J.P., I am wondering that flt and vpb and similar formats does not support paging VPB isn't a format. VPB is a tool. It generates data in any OSG-writable format, including .osg/.ive/.osgt/.osgb. It does support terrain paging with PagedLOD. (PagedLOD). In that case, osgb seems to be the best format. Can it store texture data internally, or all jpegs and pngs have to stay as separate files (possibly increasing data fragmentation)? It can do either way. osgEarth is definitely the project to look at. Thanks, Yes. If you're not interested in building it from scratch (it can be difficult the first time), my company, AlphaPixel offers subscriptions to a binaries-download system that builds projects like osgEarth every night, whenever the source has changed. John ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] best format for paged database
Hi, what is the best file format for paged scene database? The database may be both - small and big (gigabytes) and it may or may not contain geospatial data. The special requirement is that it should be possible to store non-standard data like reflective color (not present in OpenGL), for instance as a user data. I was considering to store collision geometry there as well, but this is not the strict requirement. Thanks in advice, John ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] best format for paged database
Thanks Chris and J.P., I am wondering that flt and vpb and similar formats does not support paging (PagedLOD). In that case, osgb seems to be the best format. Can it store texture data internally, or all jpegs and pngs have to stay as separate files (possibly increasing data fragmentation)? osgEarth is definitely the project to look at. Thanks, John On Wednesday 07 of December 2011 07:23:40 J.P. Delport wrote: Hi, you can also check out osgEarth. I like the fact that it can convert data (imagery and terrain) into a tms compatible format (jpg, png, tiff). How you display the data is up to you, you can add shaders to do fancy things per layer if you want. regards jp On 06/12/2011 17:44, Chris 'Xenon' Hanson wrote: On 12/6/2011 2:24 AM, PC John wrote: what is the best file format for paged scene database? The database may be both - small and big (gigabytes) and it may or may not contain geospatial data. Well, generally the only paged formats OSG supports (excepting specialized formats like TerraPage) are its own .OSG/.IVE/.OSGT/.OSGB. .OSG and .IVE are deprecated. .OSGT is text and is slower, which leaves .OSGB as the primary contender. The special requirement is that it should be possible to store non-standard data like reflective color (not present in OpenGL), for instance as a user data. Well, given that this can be stored in the scene graph, it can be stored in the .OSGB format as well. But it is up to you to design the scene graph structure to store, and utilize this data. I was considering to store collision geometry there as well, but this is not the strict requirement. You could store this geometry there too, masked so that it does not render but can be accessed during intersection testing. Thanks in advice, John ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] setCenterByMousePointerIntersection
What about: viewer-setCameraManipulator( new OrbitManipulator( DEFAULT_SETTINGS | SET_CENTER_ON_WHEEL_FORWARD_MOVEMENT ) ); Cheers, John Original message From: Joe Kilner uns...@joek.net Subject: [osg-users] setCenterByMousePointerIntersection Date: 8. 7. 2011 18:31:58 Hi, I am often loading large scenes in to a Viewer with a TrackballManipulator and would really like a nice way to reset the orbit point while viewing the model. I had a look in the code and found something looking like what I want has been implemented already and can be activated by passing the flag SET_CENTER_ON_WHEEL_FORWARD_MOVEMENT when creating the manipulator. However, I can't get it to work and am not really sure how (or even if) the feature should be used. Can anyone shed any light? Thank you! Joe -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=41275#41275 ___ 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] Quad buffered 3d, frame sequential stereo and Panasonic TV compatability
Hi Graham, neither I succeed with Samsung UE40C7000. You can see some thoughts at http://forums.developer.nvidia.com/index.php?showtopic=5885st=0gopid=18408; Feel free to contribute to the thread. I am too looking for the solution :-) . John Original message From: Graham Ericson gray...@gmail.com Subject: [osg-users] Quad buffered 3d, frame sequential stereo and Panasonic TV compatability Date: 29. 3. 2011 21:02:36 Hi, I've seen this topic come up once or twice, but I can't figure out what's going wrong in my setup. I have a new Panasonic Viera 3D TV (ST30 series) that I'm driving with a Quadro 380 FX in windows XP with OSG 2.2. I'm trying to view models in 3D, either with the vertical split or quad buffer option, and neither is working (though horizontal split works fine, oddly enough.) The graphics card is connected to the TV via HDMI. I'm using the TV's emitter and glasses. When I choose the frame sequential input option on the TV with a quad buffered input from the computer, the glasses don't activate, meaning the TV doesn't recognize that it is receiving a 3D input. If I can't get quad buffered/ frame sequential stereo to work, I'm OK with using vertical split stereo. I've worked with the GT25 Viera series in the past and have been able to get satisfactory results with vertical split stereo, but with the new model the vertical split mode looks off. The new TV recognizes the two images and combines them, but the result is headache-inducing. I've tried playing with all the TV settings and flipping the eye orientations on both the computer end and the TV end. Aside from eye swapping, none of my OSG variables (eye separation, screen dimensions etc.) have changed from the setup that ran the old TV well. Any clues as to how to get something working here? I figure the worst case scenario is returning the new TV and finding an old model to buy online somewhere, but as this is for an institution that would be quite a hassle. Thank you! -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38032#38032 ___ 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] Interest in new releases of 2.8.x?
There is one research group at our university waiting for any new official release. They ask me from time to time about it. However, they are not apparently reading mailing list too often as they are busy with their own things. I guess that number of people would welcome the new release if someone would do it. Is there any feature they specifically want in a new release, or are they just wanting the 3.0 stable release? If I remember correctly, it was mostly related to CMake scripts. Probably those responsible for finding the libraries on the disk. These should not be difficult to include in 2.8.4. I sent them email and will be back with the response soon. John ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Interest in new releases of 2.8.x?
Is there any feature they specifically want in a new release, or are they just wanting the 3.0 stable release? If I remember correctly, it was mostly related to CMake scripts. Probably those responsible for finding the libraries on the disk. These should not be difficult to include in 2.8.4. I sent them email and will be back with the response soon. Ok. They have problems with 2.8.3 CMake scripts and other issues in VS2010. That is exactly what you are going to fix. So, your release should be very welcomed :-) . John ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Interest in new releases of 2.8.x?
There is one research group at our university waiting for any new official release. They ask me from time to time about it. However, they are not apparently reading mailing list too often as they are busy with their own things. I guess that number of people would welcome the new release if someone would do it. Personally, I stick with developer releases. John Original message From: Chris 'Xenon' Hanson xe...@alphapixel.com Subject: Re: [osg-users] Interest in new releases of 2.8.x? Date: 26. 3. 2011 21:22:50 On 3/16/2011 11:27 AM, Chris 'Xenon' Hanson wrote: On 3/16/2011 11:21 AM, Robert Osfield wrote: I'm all for an 2.8.4 release. Excellent. Was there anyone else interested in a 2.8.4 release? Is anyone else using 2.8.3 at this point or is everyone on trunk now? ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] saving camera view state
What about keeping your cameraManipulator using ref_ptr (instead of deleting and creating another one. By the way, your code deals with HOME position, not with current manipulator position. If you will be still lost, look at lexolight.sf.net sources. It uses two manipulators and you can swap between them by using Ctrl. So, the scenario is not the same but the similar to yours - copying manipulator settings from one to the other. Hope it helps, John Original message From: suneel suresh compres...@gmail.com Subject: [osg-users] saving camera view state Date: 20. 3. 2011 20:44:38 Hi, i have a case where i need to delete the camera manipulator and i do so by viewer-setCameraManipulator(NULL); This freezes the camera movement and camera is locked for some editing features. Now when i toggle the edit button i do viewer-setCameraManipulator(new osgGA::TrackballManipulator); But this resets the viewing and looses the current view. So I tried to do the following Code: if(isPickMode) { viewer-getCameraManipulator()-getHomePosition(vec3_eye, vec3_center, vec3_up); viewer-setCameraManipulator(NULL); } else { viewer-setCameraManipulator(new osgGA::TrackballManipulator); viewer-getCameraManipulator()-setHomePosition(vec3_eye, vec3_center, vec3_up); } But this still resets the view position. How can it set it to the exact camera view position? p.s= new to osg ... Thank you! Cheers, suneel -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37754#37754 ___ 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] requestRedraw bug during ON_DEMAND rendering
Hi all, I am using osgViewer::Viewer in ON_DEMAND RunFrameScheme, e.g. there is no continual re-rendering and 100% CPU loading, but the scene is rendered only when really needed. Bug: The window is not repainted when obscured by another window and re-shown again. I was trying to fix the problem and these are my findings: - when window is damaged and needs to be repainted, it receives WM_PAINT (Win32) or Expose (Linux) message, or paintEvent() is called on Qt. I tried to call requestRedraw() inside these, but it is just an empty function inside osgViewer::GraphicsWindow. Is it a bug, intended behaviour or unimplemented functionality? In the first and third case, I am going to contribute the missed functionality by testing all windows from osgViewer::Viewer::checkNeedToDoFrame(). John ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] unexecpted result with SetHomePosition
Hi Vincent, void CameraManipulator::setHomePosition(const osg::Vec3d eye, const osg::Vec3d center, const osg::Vec3d up, bool autoComputeHomePosition=false) takes eye parameter as a position of the camera. Center is any position that camera is looking at, giving the orientation of the camera. However, for orientation of the camera, you have to provide even up vector, that is given as a third parameter. You can not orient the camera without up vector. The last parameter is a flag whether to recompute home position when you for instance, change the scene. You may be interested to take a look at void CameraManipulator::computeHomePosition(const osg::Camera *camera, bool useBoundingBox) method as well to automatically set home position for your scene. John Original message From: vincent sauvage sauv...@iut.u-clermont1.fr Subject: [osg-users] unexecpted result with SetHomePosition Date: 11. 2. 2011 17:04:12 Hi, my question concern setHomePosition of MatrixManipulator and subclasses. Parameters are quite explicite and in therory first one indicate position of camera, the seond parametre = target of camera ? Am i wrong... i surely forget some detail since : in practice, position and direction of camera do not corespond to the parameter given to that method . I read old topic and some source example. .. but results are sometimes so strange when changing the parameters values, that make me think i should konw some important thing or tip about this method Thank you for your help ! Cheers, vincent -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=36563#36563 ___ 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] extension detection
Hi, I am currently puzzled by some code inside OSG to detect extensions. Example code: _isSomethingSupported = OSG_GLES2_FEATURES || OSG_GL3_FEATURES || isGLExtensionOrVersionSupported(contextID, GL_EXT_something, 2.1); Question 1: Why we are sometimes testing for version? e.g. 2.1? As the extension is in extension string anyway, is it correct to consider the version number as redundant while not harmful and mostly informative for programmer? Problem 1: If there is a reference to the OpenGL number (e.g. 2.1), it is not possible to disable the functionality by osg::setGLExtensionDisableString(). Is it true? Question 2: Why we are using OSG_GL3_FEATURES ? The extension should be included in the extension string in my opinion. Or, am I mistaken? Problem 2: The same as problem 1 - functionality can not be disabled if using OSG_GL3_FEATURES. Question 3: Is the extension string of OpenGL ES the same as on standard OpenGL? Will it, for instance, contain GL_ARB_multitexture of OpenGL 1.3? Thx, John ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] NVIDIA OptiX cross-format
Hi Holger, I would prefer to have an export to OptiX native format. And if there is none, to have a class that would take OSG scene graph as a data source, setups OptiX node graph and does OptiX rendering, returning final image. That would be a very cool class for anyone interested in photorealistic raytracing! Keep me updated if you reach any nice results. John Original message From: Holger Helmich holger.helm...@gmx.de Subject: [osg-users] NVIDIA OptiX cross-format Date: 3. 1. 2011 17:29:07 Hi, i am working on an OptiX integration into an OSG based application. I am wondering if there are other projects about this issue. Currently i study to set up an serialized OptiX format (e.g. binary or XML) including reader and writter, what could be something like done for OSG (http://www.openscenegraph.org/projects/osg/wiki/Support/KnowledgeBase/Ser ializationSupport) this year. The idea would be to set up an open format (if there is none) for OptiX's node graph. Of course it is not possible as OSG input, but would probably be a first step. Thank you! Cheers, Holger -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=35267#35267 ___ 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] textures in osga
Hi, I want to put textures and geometry files to one archive file. I looked at osga plugin, but I am not sure if it can be used for such a purpose. If I read particular geometry file from osga, it may trigger loading of a texture that is used by the geometry (e.g. standard material texture). Will the texture be loaded correctly from osga in such a case? Or, is this too advanced scenario for osga? Thx, John ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org