FilterPostProcessor.setNumSamples() usage causes garbled screen?

I have an issue with FilterPostProcessor.setNumSamples(). When I first tried to use FilterPostProcessor, I quickly noticed that my application failed if I did not remove it, when exiting the game-proper screen, back to the main screen, so I have code in place that removes it:


I read relatively late, that if I use sampling, I must set it in the FilterPostProcessor too. So I started calling:


When I create the FilterPostProcessor, but if I do, the second time I start the game-proper screen (where FilterPostProcessor is used), then the screen is garbled, and the actual content is not displayed. Note that I create a new FilterPostProcessor every time, which is why I need to remove it when closing the screen (AbstractAppState).

So what should I do? Not call it at all? Even calling it only once, the first time a FilterPostProcessor is created, causes the bug. I also checked that the correct sample is set (4 in my case).

I would trace through and make sure that things are really getting removed and recreated like you think they are. I also create my fpp on initialize() and remove it on cleanup() and I don’t have the issue.

The only difference (and it shouldn’t be relevant but I will include it anyway) is that I call it like this:
fpp = new FilterPostProcessor(app.getAssetManager());
int numSamples = app.getContext().getSettings().getSamples();
if( numSamples > 0 )