Oliver Neumann wrote:
Hi Juan,

Thanks for the demo code. It runs without a problem. I found the
critical line:

viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);

If i comment it out, the demo code crashes with the same error text
as above. Very weird...
Indeed, I added that line because in other threading models the viewer.frame() function returns inmediately. In that case osgDB::writeImageFile will be most probably accessing an invalid image object (not allocated or not rendered) and will fail. However the error I get if I remove that line is quite different.

> I tried to add this line to my code, but I
> still have some minor bugs to fix. Appart from that, is it possible
> to run a hidden viewer in a multithreaded fashion

As Robert already answered, it should be possible.
The best explanation that I have for your problem is that some thread fails to do wglMakeCurrent (after that call fails anything that follows is just garbage) beacuse another thread is holding the context (according to http://www.opengl.org/sdk/docs/man/xhtml/glXMakeCurrent.xml, that's a programming error in GLX, so I guess the same applies in WGL). All OpenGL calls from that thread are going to fail after that.

If the sample code that I sent you also complains with the error message:
PixelBufferWin32::makeCurrentImplementation, wglMakeCurrent error: Die angeforderte Ressource wird bereits verwendet then, there is a threading error somewhere. However I can't spot it the code I sent you and I'm afraid that's beyond my knowledge of OSG's guts. Robert may be more insightful here.

You can try commenting the line that changes the threading model and replacing frame() by run() to see if it also fails.

Hope that helps,
Juan




_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to