Hello,
I have to update a texture at each frame (from an image taken by a firewire camera). I can display the first image but after, it doesn't change.
Here is the code in update():
texture.setImage(TextureManager.loadImage(textureRGB,false));
textureRGB_state = display.getRenderer().createTextureState();
textureRGB_state.setTexture(texture);
textureRGB_state.setEnabled(true);
tbb.clearRenderState(StateType.Texture);
tbb.setRenderState(textureRGB_state);
tbb.updateRenderState();
where textureRGB is my Image (which is well updated, i checked by saving in files), tbb is a TerrainBlock.
I tried reinitialising "texture" like this:
texture = TextureManager.loadTexture(textureRGB,Texture.MinificationFilter.BilinearNearestMipMap,
Texture.MagnificationFilter.Bilinear,true);
It works, but a memory error occurs after a few seconds.
Is there another method to update the texture or must I use TextureManager.loadTexture and free some object ? (and if I have to, how ?).
Thanks.
EDIT: I found a solution by using "TextureManager.releaseTexture(texture);" before TextureManager.loadTexture. But is it possible to avoid release/reload and just change the image ?