Forum Discussion

cpjamloki's avatar
cpjamloki
Visitor
11 years ago

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.

5 Replies

  • 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.
  • 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.
  • roku sdk not provide to remove whole texturemanager.
    Is there any method to delete/remove/drop whole texture manager.
  • 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