Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
gabek
Level 7

Starting a roScreen from a SceneGraph component

I've been trying to dig into accomplishing this, but all signs point to "not possible", but that would be ridiculous if it were true.

A common scenario would be to have menu components and then launch into a roScreen, but creating an instance of one within a SceneGraph render thread returns back "invalid".

Currently, this puts me in a scenario where I can't update my application piece by piece but instead would need to rewrite the entire thing at once.  And rewriting my roScreen in SceneGraph would not be a small task.  I'd love if somebody could prove me wrong!
0 Kudos
3 Replies
belltown
Level 7

Re: Starting a roScreen from a SceneGraph component

Assuming this is possible: Instead of creating an roScreen from within a Scene Graph Render thread, try creating it from the Main thread.

If your menu is implemented in the Scene Graph Render thread, you could set a field on the Global node, which would be observed by the Main thread, to trigger the creation of the roScreen.

I'm not sure if it would work, but that would sound like your best option. You can do several things from the Main thread that you can't do from a Render (or Task) thread.
https://github.com/belltown/
0 Kudos
Roku Employee
Roku Employee

Re: Starting a roScreen from a SceneGraph component

"gabek" wrote:
A common scenario would be to have menu components and then launch into a roScreen, but creating an instance of one within a SceneGraph render thread returns back "invalid".

Creating a roScreen from inside a RSG render thread? <shiver/> perish the thought!
The two are immiscible, in the sense they cannot function at the same time - if roScreen is created, roSgScreen gets suspended and vice versa. To this i am glad to hear that trying to create roScreen from the render thread returned invalid - i don't want to contemplate what suspending a thread because of it creating roScreen would look like but feels like cutting branch one is sitting on.
Do it from the main thread - when done with roScreen and closing it, RSG should get resumed.
0 Kudos
gabek
Level 7

Re: Starting a roScreen from a SceneGraph component

Thanks for pointing me in the right direction!  I had originally tried spawning roScreen from a Task, and while it did display, it didn't, as you mentioned "function".  So that makes complete sense.

Thanks, all!
0 Kudos