filter(GRAY) makes everything gray

In my game I am trying to make a button grayscale (temporarily) but not anything else. But it seems that there is no way to disable a filter after it is applied?

pushStyle();
button.draw();
if (!button.pressable) filter(GRAY);
popStyle();

This is supposed to make the just the button gray (for some reason its also supposed to go after the button render??)

The code is at the end of the entire draw loop and it is also surrounded by push & pop style. I don’t understand why this works like this…

Try button.filter(GRAY); It may be the problem but not 100% sure without seeing the rest of the code, if that doesnt work either try

button.pushStyle();
button.draw();
if (!button.pressable) button.filter(GRAY);
button.popStyle();

hopefully one of them works

1 Like