Hi Robert,

As we don't know whether this is the cause of the problem yet, I've
modified J-S's osgviewer.cpp to do the resize.  Could users who've
seen problems try this version out, if this works then we have
workaround that end users can apply to existing apps, and we can
figure out a solution to fix it permanently in svn/trunk.

I'm in the process of building OSG and the modified osgviewer.cpp following an svn update which I shouldn't have done (would have been quicker). I'll let you know my results.

I've seen another threading-related problem. When creating a new context, I'm getting crashes caused by the fact that GraphicsWindowWin32::realize() calls makeCurrent(), which looks like this:

bool GraphicsContext::makeCurrent()
{
    bool result = makeCurrentImplementation();

    if (result)
    {
        _threadOfLastMakeCurrent = OpenThreads::Thread::CurrentThread();

        // initialize extension process, not only initializes on first
        // call, will be a non-op on subsequent calls.
        getState()->initializeExtensionProcs();
    }

    return result;
}

The call to getState()->initializeExtensionProcs() calls glGetString( GL_VERSION ) to check some things. Now, it can happen that between the makeCurrentImplementation() and the glGetString() in initializeExtensionProcs(), some other graphics thread that wanted to draw called makeCurrent() as well, and thus when glGetVersion() is called it no longer has the context current.

Obviously we have to be pretty unlucky to run into this, but as the number of contexts becomes larger, it has more chances of happening (or even the opposite, a graphics thread doing some drawing and then we construct a new GraphicsWindowWin32 which calls makeCurrent() and the graphics thread's context is no longer current).

Whichever thread we create contexts on, I think there's no way to be sure that no graphics thread is currently drawing (since the draw for thread n-1 might overlap the event,update,cull of frame n in certain threading modes) am I right? Should there be some mutex to prevent makeCurrent() while another thread is drawing, or makeCurrent() while a context is being created?

I'm trying to get my head around these threading problems. Keeping track of on which thread a given method will be called is a bit hard sometimes.

Thanks,

J-S
--
______________________________________________________
Jean-Sebastien Guay    [EMAIL PROTECTED]
                               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

Reply via email to