Re: [osg-users] Draw thread per opengl context instead of per GraphicsContext

2017-11-13 Thread Ben Meijering
Hi Robert,

Ah ok, so the GraphicsContext::Traits::sharedContext doesn't share the actual 
context, but allows object sharing between contexts. 
Thanks for clearing that up for me, I think this changes what I am looking for.

The reason that I am looking into this, is because of the following 
measurements.
In all tests, the screenspace view sizes and rendered objects are the same.

1. 6 views in one window (singlethreaded)   24.3 fps
2. 6 views in one window (multithreaded)46 fps

In these two tests, we have 1 context and 1 draw thread. 
Enabling multithreading almost doubles the performance.
So, performing culling on another thread proves to be very effective.

3. 6 views in separate windows (multithreaded) 
11.7 fps
4. 6 views in separate windows with context sharing (singlethreaded)22 fps

The last test cannot be done with multiple render threads, which makes sense.
But I think (please correct me if I'm wrong), multiple separate cull threads 
should have no effect on it's correct operation.
Looking at the performance difference between test 1 and 2, I am eager to see 
what culling on a different thread(s) would do here.

So my question changes to: for test 4, is it possible to still use separate 
cull threads while we only use 1 draw thread.
And if not, could you give us pointers on what should be taken into 
consideration if we want to implement this.

Thanks!

Cheers,

Ben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72376#72376





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


Re: [osg-users] Draw thread per opengl context instead of per GraphicsContext

2017-11-10 Thread Ben Meijering
Hi Robert,

Thanks again for your quick response.

Isn't an opengl context already used by multiple windows when you use 
GraphicsContext::Traits::sharedContext ?

I also came across the following function:

BOOL WINAPI wglMakeCurrent(
   HDC   hdc,
   HGLRC hglrc
);

A window device context can be specified here, so it would seem that you can 
change the window.

I also came across the following:

https://blog.gvnott.com/some-usefull-facts-about-multipul-opengl-contexts/

This also seems to state that a single opengl context can be used to render to 
multiple windows.

Thank you!

Cheers,

Ben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72355#72355





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


Re: [osg-users] Draw thread per opengl context instead of per GraphicsContext

2017-11-10 Thread Ben Meijering
Hi Robert,

Thank you for your response.

I don't want to share the context or GL objects in multiple threads.
Basically what I want is 1 draw thread for the 1 opengl context if have and 1 
cull thread.

I want this 1 opengl context to be shared by multiple windows.
However, for each window that I create, a new draw thread is created, even when 
they share the same opengl context.

So I was hoping that it was possible to have 1 draw thread per opengl context, 
instead of 1 draw thread per window (GraphicsContext).

The opengl context would only be used by one thread, so thread safety shouldn't 
be an issue right?

Cheers,

Ben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72353#72353





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


[osg-users] Draw thread per opengl context instead of per GraphicsContext

2017-11-09 Thread Ben Meijering
Hi everyone,

I want to use the GraphicsContext::Traits::sharedContext to render multiple 
views (in multiple windows) that share the same context.

I already read on some forums that the ThreadingModel::SingleThreaded  should 
be used.

However, I would still like to use ThreadingModel::DrawThreadPerContext so that 
the cull and draw thread can overlap.

I tried this, but a draw thread is created per GraphicsContext and thus per 
window. Because all these windows share an opengl context, I would have 
expected that only 1 thread would have been created.

This results in all sorts of problems.

Is there a way in which I can use 1 draw thread per opengl context ?
And, if not, is this something that I can easily change by modifying the code ?

Thank you!

Cheers,
Ben

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72344#72344





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