Hi Matthias,
Along similiar lines I earlier implemented a OSG_INIT_SINGLETON_PROXY
macro and used this in src/osgViewer/Scene.cpp to address exactly the
same issue you have looked in RenderBin.cpp. I've now moved this
macro into include/osg/Object and added it's usage into RenderBin.cpp
which should achieve the same end as you modification, but with a few
less lines of code and a with lanaguage that will hopefully help
readers understand it's role. The macro is defined:
/** Helper macro that creates a static proxy object to call singleton
function on it's construction, ensuring that the singleton gets
initialized at startup.*/
#define OSG_INIT_SINGLETON_PROXY(ProxyName, Func) static struct
ProxyName{ ProxyName() { Func; } } s_##ProxyName;
And it's usage is:
// Use a proxy to force the initialization of the the
RenderBinPrototypeListSingleton during static initialization
OSG_INIT_SINGLETON_PROXY(RenderBinSingletonProxy, renderBinPrototypeList())
Could you update to svn/trunk and let me know if this works fine for you.
Thanks,
Robert.
On 18 July 2012 08:54, Matthias Schütze <[email protected]> wrote:
> Hi there,
>
> According to the forum thread
> http://forum.openscenegraph.org/viewtopic.php?t=9124, it was discussed
> to use a local static initializer object in order to call
> renderBinPrototypeList() and thus suppress some sporadical warnings. I
> found that forum thread because I experienced very similar problems:
> - sporadical "Warning: RenderBin "RenderBin" implementation not found,
> using default RenderBin as a fallback"
> - even more sporadical "Warning: RenderBin "DepthSortedBin"
> implementation not found, using default RenderBin as a fallback"
> - the problem occurs, when setting up some scene data for several
> views on program start
> - most likely, the problem occurs only with multi-threaded threading
> models (furthermore, I could observe concurrent initialization of
> static RenderBinPrototypeList while debugging)
>
> I have attached the svn trunk version of RenderBin.cpp including the
> relevant changes suggested by Robert in the forum thread mentioned
> above. After recompiling my OSG 3.0.1 with this change, I tried it out
> on a couple of Win 7 x64 machines where the problem occurred from time
> to time. Well, the warnings did not show up in about 500 runs per
> system.
> As I stated in the web repository of svn trunk, this change was not
> committed yet. Maybe, one could submit it, now?
>
> Cheers,
> Matthias Schütze, Germany
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org