HI Markus, I'm afraid the OSG has built in thread protection for sharing GL objects whilst multi-threading the graphics contexts that share those GL objects. You will very likely hit up against threading issues.
When multi-threading contexts by default the OSG manages seperate GL objects per context to avoid threading issues that would otherwise be associated with sharing objects between threads. To add such general thread safe GL object sharing support into the OSG would be complex to design, implement and maintain and would compromise performance. If it were easy and lightweight to support the OSG would already do it. Robert. On 13 November 2014 16:06, Markus Hein <[email protected]> wrote: > Hello All, > > I wonder how can I make sure that glBufferObjects are properly shared ? > My app runs two renderthreads, rendering the same scene , using the same > BufferObjectBinding. I want to share GLContext and need to work on the > same buffer object from both threads. > > Under Debug I can see that glBufferObjects are created for each > RenderThread by GlBufferObject::Extensions::glGenBuffers() , even if I > have only one BufferObject in my Scene, so I guess there are 2 copies in > GPU memory for each context. Under execution I see that one renderthread is > working on" the right" BufferMemory while the other one is reading data > from the second glBufferObject. I want to avoid this and want to make sure > that both renderthreads are reading from the same buffer on GPU. > > Maybe I need to tell OSG that it should not create a BufferObject for > each RenderThread , instead it should share the only one BufferObject I > want to read from both threads ? > > This way I tried to share GL Context between two renderthreads: > > firstRenderThreadTraits->sharedContext = secondRenderThreadContext; > > > (called before realize()) ist this enough for proper sharing ? > > > This way I access BufferObject data from VertexShader Program : > > layout(std140, binding = 0) buffer particles{vec4 p[];}; > > > Did I forgot to set something something in my app code, or do I need to > dig deeper in this case ? > > thanks, Markus > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

