Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
NewManLiving
Visitor

roTextureManager

This object is faster than its counterpart the roUrlTransfer object and apparently
Keeps a cache in the temp directory. Is there any
Other information on how this works, specifically
It's impact on the applications 50 mg that was
Discussed in another thread. And also any other
Information on how it works ie..what it stores in
Memory as opposed to what it stores on disk
As both are impacted but It is overall a reasonable
Manager
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
7 REPLIES 7
TheEndless
Channel Surfer

Re: roTextureManager

The roTextureManager is faster, because it creates the bitmap asynchronously. It will also manage its own memory usage with its built-in LRU routine, but it gets tricky if you keep references to the bitmaps it creates open elsewhere and/or create bitmaps outside of it. It also seems a little unpredictable when used with video playing. It's perfect for applications like your grid sample, as you can display loading bitmaps while loading the real bitmaps asynchronously with much lower impact on your framerate.

It'd be even better if you could call GetBitmap() on the roTextureRequest with a GetState() of 4/Ready, instead of having to listen for the roTextureRequestEvents and keep track of it separately by request ID, but hey ho...
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
NewManLiving
Visitor

Re: roTextureManager

"TheEndless" wrote:


It'd be even better if you could call GetBitmap() on the roTextureRequest with a GetState() of 4/Ready, instead of having to listen for the roTextureRequestEvents and keep track of it separately by request ID, but hey ho...


Yes wondered that myself. Tganks
My Channels: 2D API Framework Presentation: https://owner.roku.com/add/2M9LCVC
Updated: 11-11-2015 - Completed Keyboard interface
The Joel Channel ( Final Beta )
0 Kudos
Greg47
Visitor

Re: roTextureManager

Does anybody have an example of using the roTextureRequest and Manager in the background? I have it setup to create loading bitmaps first of all the data, but having trouble figuring out how to kick off and let the real images fill in as they are ready. Thanks.
0 Kudos
TheEndless
Channel Surfer

Re: roTextureManager

"Greg47" wrote:
Does anybody have an example of using the roTextureRequest and Manager in the background? I have it setup to create loading bitmaps first of all the data, but having trouble figuring out how to kick off and let the real images fill in as they are ready. Thanks.

That's where being able to pull the bitmap directly from the roTextureRequest would come in really handy. Probably the best way to do it would be to share the message port, so you can listen for roTextureRequestEvents while you're listening for roUniversalControlEvents from your screen.

Alternatively, you could assign two different ports and check them both (with GetMessage()) on each pass through your event loop.

While True
textureMsg = m.TextureMgr.GetMessagePort().GetMessage()
If textureMsg <> invalid Then
...
End If
screenMsg = m.Screen.GetMessagePort().GetMessage()
If screenMsg <> invalid Then
...
End If
End While
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Greg47
Visitor

Re: roTextureManager

"TheEndless" wrote:
"Greg47" wrote:
Does anybody have an example of using the roTextureRequest and Manager in the background? I have it setup to create loading bitmaps first of all the data, but having trouble figuring out how to kick off and let the real images fill in as they are ready. Thanks.

That's where being able to pull the bitmap directly from the roTextureRequest would come in really handy. Probably the best way to do it would be to share the message port, so you can listen for roTextureRequestEvents while you're listening for roUniversalControlEvents from your screen.

Yeah that was the approach I was thinking of and was doing too. Just sharing the same port between the two. I'm creating the dummy bitmaps first to draw out the layout quickly and then I'm trying to figure out how to replace the dummy ones as the images finish downloading. I can kick off the request perfectly fine doing something like:


function getItems(textureManager As Object) As Object
items = CreateObject("roArray", 25, true)
for i = 0 to 25

bitmap = CreateObject("roBitmap", {width: width, height: height, AlphaEnable: true})
bitmap.Clear( &h222835FF )

request = CreateObject("roTextureRequest", "external url")
textureManager.RequestTexture(request)

items.Push(bitmap)

end for
return items
end function


But then I'm struggling to figure out how to connect the requested bitmap back to the items array. I thought I could maybe get the request event id's and then connect that back to the item array index, but it does't seem that the event id is kicked off on every single item. It seems like it doesn't actually get the id until the async is complete. And maybe I'm trying to kick off the download in the wrong spot. Thanks for any help.
0 Kudos
TheEndless
Channel Surfer

Re: roTextureManager

"Greg47" wrote:
But then I'm struggling to figure out how to connect the requested bitmap back to the items array. I thought I could maybe get the request event id's and then connect that back to the item array index, but it does't seem that the event id is kicked off on every single item. It seems like it doesn't actually get the id until the async is complete. And maybe I'm trying to kick off the download in the wrong spot. Thanks for any help.

The roTextureRequest.GetID() matches the roTextureRequestEvent.GetID(), so you should use that to link the two.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Greg47
Visitor

Re: roTextureManager

"TheEndless" wrote:
"Greg47" wrote:
But then I'm struggling to figure out how to connect the requested bitmap back to the items array. I thought I could maybe get the request event id's and then connect that back to the item array index, but it does't seem that the event id is kicked off on every single item. It seems like it doesn't actually get the id until the async is complete. And maybe I'm trying to kick off the download in the wrong spot. Thanks for any help.

The roTextureRequest.GetID() matches the roTextureRequestEvent.GetID(), so you should use that to link the two.
Thanks. I was thinking the id wasn't there until after the event request triggered, but it is there before so that helps a lot. Thanks.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.