Hi Chris,
On 8/2/06, Chris Hanson <[EMAIL PROTECTED]> wrote:
Line 46 of Stateset.cpp:
_textureModeSet.insert(GL_TEXTURE_1D);
does NOT appear to be hit, prior to the exception and crash in my
application.
Ok, its pretty clear that the static object is not getting created
before its being used. A singleton function call is the solution. I
can modify this code and check it in.
I confess, I am a little perplexed by the problem. Could someone with maybe
a wider
knowledge of the static initialization situation explain to me what exactly is
going on,
and how an object can come into being without being properly constructed?
Mark Barnes provided the following info in a mail recently (on the
topic OSX and Static initialization)
C++ mandates that a static variable is initialized the first time
control passes through its declaration. Both of these OS behaviors are
permitted by C++ with some caveats. Again see [basic.start.init] and
related sections.
In this instance I think the solution is mashal access to some of the
OSG statics so that it goes via functions that have local static
declaration of the object. For instance I've just changed the
relevant StateSet.cpp code from:
static TextureGLModeSet s_textureGLModeSet;
To:
static TextureGLModeSet& getTextureGLModeSet()
{
static TextureGLModeSet s_textureGLModeSet;
return s_textureGLModeSet;
}
And changed all the code that used s_textureGLModeSet to be
getTextureGLModeSet() instead.
This is now checked in.
Let us know how the static build is prograessing.
Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/