Search code examples
rajawali

How to switch bitmap texture of Object by using rajawali?


I want to develop a function that there are has a object in my scene, and this object has a bitmap texture. Then if you touched the object, its texture will be switched to another one, how can I implement it?


Solution

  • After few days study, I find a way which can resolve my texture replacement issue, please reference the below codes:

    Texture texture = getTexture(TOAST_TEXTURE_NAME);
    texture.setBitmap(mToastTextTexture.textAsBitmap(toastString));
    TextureManager.getInstance().replaceTexture(texture);