I have a textbox which changes the texture of a 3d Model depending on the text inside. So if there was a texture named red.png in the src folder, and I entered "red" into the textbox, it loads the red texture onto the model. The problem is that the texture is only loaded once when the application is run, if I edit the textbox after that, the texture doesn't change. So how would I go about refreshing the texture to match the text in the textbox? I'm using LWJGL 2.9.3 with the Netbeans IDE 8.2. Here's my code for loading textures:
String playerTexture = PlayerTexture.getText();
//loads the obj file
RawModel model = OBJLoader.loadObjModel("player", loader);
//Sets the Texture
TexturedModel staticModel = new TexturedModel(model,new ModelTexture(loader.loadTexture(playerTexture)));
//A little later in the code
ModelTexture texture = staticModel.getTexture();
Comments
Post a Comment