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: 
cpjamloki
Visitor

Cleanup roTextureManager

Hi,
i am creating some bitmap using roTextureManager. in different button click i am calling texturemanager for creating bitmap and show it on roScreen. but it is drawing bitmap two time (giving ready state=3) ,after third term it is giving state=4 which is fail why?
if m.mgr3 <> invalid


m.mgr3.Cleanup()

end if

m.mgr3 = CreateObject("roTextureManager")
port1 = CreateObject("roMessagePort")
m.mgr3.SetMessagePort(port1)

m.mgr3.UnloadBitmap(m.myarray[0])


whenever each time i am clearing manager.
0 Kudos
5 REPLIES 5
NewManLiving
Visitor

Re: Cleanup roTextureManager

Texture manager is responsible for textures is loads and unloads
Why are you recreating the texture manager and then asking it to unload a bitmap it has no knowledge of. A newly created manager is empty. Also even if you did not recreate it you empty it if it is valid so either way it's incorrect
(Unless a great deal of your code is missing )you never request a texture from the newly created manager but request it to unload whatever is in myArray. You Generally create a texture manager only one time. Load and unload from the same 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
cpjamloki
Visitor

Re: Cleanup roTextureManager

i have different button. and different image is coming from different button click. so for getting it i am using rotexturemanager. so each time i am calling same function where my texturemanager is created. here i am checking if texturemanager have already bitmap clear it. and upload new bitmap in it. first 2 time(click on 2 different button) it is working fine. but after that giving state 4. so please suggest me is there is any example for it?
and can i achieve this from this method?
if no what is alternate method there.
By the way i am using roScreen.
0 Kudos
NewManLiving
Visitor

Re: Cleanup roTextureManager

All you need is one texturemanager created at the start of the program. Request and unload bitmaps as you need them
Look at this example
viewtopic.php?f=34&t=70983#p446193
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
cpjamloki
Visitor

Re: Cleanup roTextureManager

roku sdk not provide to remove whole texturemanager.
Is there any method to delete/remove/drop whole texture manager.
0 Kudos
NewManLiving
Visitor

Re: Cleanup roTextureManager

You can call cleanup as you know this completely empties the manager and releases all bitmaps. However if you still have other variables that are referencing the bitmaps then you have to invalidate them as well. Just like any other variable, memory is not released until all references are invalid
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