Message: Re: ogl refresh from threads Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: ogl refresh from threads 

Forum: Multithreading
Re: None ogl refresh from threads
Re: None Re: ogl refresh from threads (John Allison)
Re: None Re: ogl refresh from threads
Date: 05 Oct, 2017
From: John Allison <John Allison>

> I tried this:
> 
> /vis/disable /event/keepCurrentEvent
> 
> /run/beamOn 100
> 
> /vis/enable /vis/reviewKeptEvents
> 
> w/o success.

Try /vis/enable /vis/viewer/flush

/event/keepCurrentEvent seems to need to be applied during event processing and I haven't figured out how to do that. But the following works for me. Put this in your end of event action

    G4EventManager::GetEventManager()->KeepTheCurrentEvent();

then

  /vis/disable
  /run/beamOn
  /vis/enable
  /vis/viewer/flush

Inline Depth:
 0 0
 1 1
Add message: (add)

None Re: ogl refresh from threads  by <ungaro@jlab.org>,   05 Oct, 2017
Re: None Re: ogl refresh from threads (John Allison)
Ok I've done as suggested:

commandsChain:

 /vis/disable
 /run/beamOn
 /vis/enable
 /vis/viewer/flush
 /vis/reviewKeptEvents (<< this was also needed)

Getting closer but not there yet. The screen is indeed updated from the main thread (yay!). However:

1. I can only do it once. Subsequent commandsChain seems not to work anymore

2. This only works with the very last event, i.e. beamOn 100 does not keep all 100 events.

Googling around it seems that that GL context is strictly thread local, but it could be "released" and given to another thread. For example:

https://stackoverflow.com/questions/21048927/initializing-opengl-context-in-another-thread-than-the-rendering

Now, I realize this is a very particular problem that may not be of interest to the community. And it's threads, so not trivial. And it's OpenGL so its not trivial. So I understand if it cannot be addressed easily, and I could adopt plan B of using RunManager instead of MTRunManager.

None Re: ogl refresh from threads  by John Allison <John Allison>,   06 Oct, 2017
Re: None Re: ogl refresh from threads
>  /vis/disable
>  /run/beamOn
>  /vis/enable
>  /vis/viewer/flush

Only works if, as I've said twice, you put

  G4EventManager::GetEventManager()->KeepTheCurrentEvent();

in your end of event action. Have you done that?

None Re: ogl refresh from threads  by <ungaro@jlab.org>,   06 Oct, 2017
Re: None Re: ogl refresh from threads (John Allison)
Yes I did sorry forgot to mention it.

 Add Message Add Message
to: "Re: ogl refresh from threads"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews