Were are you changing, adding, removing etc the text.
 
You need to ensure you are updating only in the APP thread ( not a gui
thread )
>From the snippet below, you need to do this in the Render function ( or
that thread ) or in the Update traversal
 

Gordon

__________________________________________________________
Gordon Tomlinson

Product Manager 3D
Email  : gtomlinson @ overwatch.textron.com
__________________________________________________________
(C): (+1) 571-265-2612
(W): (+1) 703-437-7651

"Self defence is not a function of learning tricks 
but is a function of how quickly and intensely one 
can arouse one's instinct for survival" 
- Master Tambo Tetsura

 
 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris
Sent: Wednesday, October 08, 2008 2:48 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] osgText crash


Thanks Robert,

I do realize it's tough to tell without seeing the code. Up to yesterday
I used osg 2.1, but just upgrade to 2.7.1 (bug still occurs).  FWIW, I'm
not using the viewer setup in the examples, I use my own
osgUtil::SceneView and use cull & draw directly. Note I setup my
viewport properties on each rendered frame, as these are animated. The
basic code is like:

void render()
{
    osgProducer::OsgSceneHandler *sh =
dynamic_cast<osgProducer::OsgSceneHandler *> ( _cam.getSceneHandler() );
    osgUtil::SceneView* sv = sh->getSceneView();
    sv->setSceneData( (osg::Node *) getSceneNode(0) );
    osg::State* state = sv->getState();
    state-> dirtyColorPointer();

    sv->setProjectionMatrix( projection );
    sv->setViewMatrix( *_viewMatrix );
    sv->setViewport( clippedViewport.x, clippedViewport.y,
clippedViewport.xdim, clippedViewport.ydim );

    //sv->update(); no anims, no need to update ?
     sv->cull();
     sv->draw();
}



On Wed, Oct 8, 2008 at 2:13 PM, Robert Osfield
<[EMAIL PROTECTED]> wrote:


        Hi Chris,
        
        With so few details about your viewer setup and scene graph
usage the
        best we can do is guess what you might have done wrong given
other
        common mistakes we see pop up - have the DataVariance
recommendation.
        
        Another thing you could try setting the threading model on the
viewer
        by calling
        
            viewer.setThreadingMode(osgViewer::Viewer::SingleThreaded);
        
        Again it's a long shot given we really don't know enough about
the OSG
        version you are using, which viewer library/classes and the fact
        you're trying to control everything thing through swig wrappers.
        
        Robert.
        

        On Wed, Oct 8, 2008 at 7:04 PM, Chris <[EMAIL PROTECTED]>
wrote:
        > I had just read the osg archive and set the text DataVariance
to DYNAMIC,
        > with high hopes..unfortunately still crashes :(
        >
        > _text->setDataVariance(osg::Object::DYNAMIC);
        >
        > I create my Text in response to a keystroke, and add it to the
scene. The
        > next keystroke removes and deletes it. Each time I create it,
the initial
        > rendered text string does not change.
        >
        > ( Also set my loaded osgText::Font to DYNAMIC DataVariance,
doesn't help. )
        >
        > BTW I noticed there were some nvidia problems in the archives;
I do have an
        > NVidia driver (my machine is a Toshiba Tecra M4, Geforge Go
6200 (three
        > years old), driver date 3/14/2005, version 7.1.4.1 )
        >
        > as per your StateSet DataVariance comment, should i do that as
well ? I'm
        > not familiar with osg's thread models, but I just call render
within my
        > app's main thread, and I dont' explicitly create other threads
myself.
        >
        > On Wed, Oct 8, 2008 at 1:21 PM, Paul Melis
<[EMAIL PROTECTED]> wrote:
        >>
        >> Robert Osfield wrote:
        >>>
        >>> Are you dynamically updating the text each frame?  If so set
the
        >>> DataVariance to DYNAMIC.
        >>>
        >>
        >> Hmmm, if setting it to STATIC causes a crash like this, might
that be a
        >> design flaw?
        >>
        >> Paul
        >>
        >>> Robert.
        >>>
        >>> On Wed, Oct 8, 2008 at 6:09 PM, Chris <[EMAIL PROTECTED]>
wrote:
        >>>
        >>>>
        >>>> Hi,
        >>>>
        >>>> I'm having semi-random crash bugs when I add an osgText
drawable to my
        >>>> scene. The actual error is a mem access violation, and it
occurs after
        >>>> I've
        >>>> added & removed the node containing the drawable from the
scene a random
        >>>> number of times' (usually from 1 to 10 times)
        >>>>
        >>>> The exception occurs in the same place in the call stack,
apparently
        >>>> somewhere in my open gl .dll (nvoglnt.dll). One thing that
puzzles me is
        >>>> that I'm using SWIG, and from the call stack the function
        >>>> PySwigObject_Check(PyObject *op) ) seems to call into the
osgUtil .dll,
        >>>> which in about 10 stack layers ends up calling nvoglnt.dll.
I don't know
        >>>> why
        >>>> 'PySwigObject_Check' would be caling the osg .dll, (see
func copied
        >>>> below),
        >>>> but maybe some sort of wierd thread confusion ?
        >>>>
        >>>> SWIGRUNTIMEINLINE int
        >>>> PySwigObject_Check(PyObject *op) {
        >>>>  return ((op)->ob_type == PySwigObject_type())
        >>>>    || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
        >>>> }
        >>>>
        >>>> The crash does NOT occur if I repeatedly create/delete the
osgText
        >>>> drawable
        >>>> but don't add it to my scene. It does not crash during the
render but
        >>>> seems
        >>>> to corrupt something that fails elsewhere (apparently in
        >>>> 'PySwigObject_Check' )
        >>>>
        >>>> While I can't be certain it's not my code, I have been
running the same
        >>>> render code (which uses osg) now for a few years without
problems.  Note
        >>>> that I dont explictly create extra threads in my code,
beyond what osg
        >>>> might
        >>>> be doing.
        >>>>
        >>>> I thought this looked like some thread/mutex problem, or
pehaps a VC++
        >>>> STL
        >>>> problem   (anyone had these issues with osg Text before?) I
created a
        >>>> new
        >>>> version of osgText that hacks out the STL-based 'String'
class used to
        >>>> 'setText', but no dice.
        >>>>
        >>>> I was running on WinXP, using compiler: Visual Studio .net
2002.  I just
        >>>> installed Osg 2.7.1, and Visual Studio Express 9.0; but the
crash still
        >>>> occurs.
        >>>>
        >>>> TIA,
        >>>> Chris
        >>>>
        >>>> --
        >>>> www.sketch3.com
        >>>>
        >>>> _______________________________________________
        >>>> osg-users mailing list
        >>>> [email protected]
        >>>>
        >>>>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
        >>>>
        >>>>
        >>>>
        >>>
        >>> _______________________________________________
        >>> osg-users mailing list
        >>> [email protected]
        >>>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
        >>>
        >>
        >> _______________________________________________
        >> osg-users mailing list
        >> [email protected]
        >>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
        >
        >
        >
        > --
        > www.sketch3.com
        >
        > _______________________________________________
        > osg-users mailing list
        > [email protected]
        >
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
        >
        >
        _______________________________________________
        osg-users mailing list
        [email protected]
        
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
        




-- 
www.sketch3.com

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to