As far as I know, I'm not using concurrency (at least not explicitly), so I guess I'm in the render thread. And damn, didn't know I was leaving those textures like that.... thanks.
And for this project, leaving the textures I don't think is an option, because I want the game to run in any video card from Pentium 4 integrated and up, and I'm making a Pokemon-like MMO... which means there will be around 100 different creatures with different textures in different fights, so if the client were to be left open for extended gameplay, those and the player (which will be customizable, increasing the amount of textures) and terrain textures will build up.
removeAndUnload can only cause that if you are still rendering objects that use these textures.
What do I have to do then? Inside my loop I have:
display();
changeRoom();
removeTextures();
Thread.yield();
private void changeRoom(){
if(nextRoom!=null){
room.dispose();
world.removeAll();
sky.removeAll();
switch (nextRoom) {
case TITLE:
room=new Title(this);
break;
case GAME:
room=new Game(this);
break;
default:
break;
}
nextRoom=null;
}
private void removeTextures(){
for (String name : texturesForRemoval) {
TextureManager.getInstance().removeTexture(name); //This is the line that will become removeAndUnload()
}
texturesForRemoval.clear();
}
So, I thought since the objects are removed before the textures unloaded they should have already be "Not rendered".