Hi again,

So I'll investigate a bit more as to why pbuffer is failing. We've not
ruled out a driver bug or an OSG bug here as far as I can see, it could
still be both, since all the OSG pbuffer examples I've tried have failed
in the same way.

I've tried an example that uses straight WGL_ARB_pbuffer code and it works fine. I found the example on the web, see here:

http://www.codesampler.com/oglsrc/oglsrc_7.htm

See the example "Off-screen Rendering Using Pixel Buffers" and I used version #1.

However this still doesn't prove it isn't a driver bug, since this example is single threaded and if I make the pbuffertest example single threaded (by adding viewer.setThreadingModel(osgViewer::ViewerBase::SingleThreaded); after the viewer creation) it works too.

I've debugged what happens, and roughly the sequence is this:

1. main(): createGraphicsContext(traits.get())
   ---> PixelBufferWin32 is created successfully

2. main(): viewer.realize()
---> PixelBufferWin32::makeCurrentImplementation() is called, and succeeds.

3. GraphicsThread::run()
---> PixelBufferWin32::makeCurrentImplementation() is called, and fails with "The requested resource is in use".

I don't know why the second makeCurrentImplementation would fail, but going from Juan's hunch that it was failing because some other thread was holding on to it (the main thread in this case), I added the following code after viewer.realize(); :

    viewer.stopThreading();
    gc->releaseContext();
    viewer.startThreading();

This made it work.

This is obviously not a solution. It worked as-is before on Linux, so perhaps on Windows the makeCurrent() call makes the context "exclusive" to the thread on which it was called, whereas on Linux a subsequent makeCurrent() will still succeed and just remove the context from the previous thread that had it current silently?

Just theorizing here.

Any other ideas?

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               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