Problem with inconsistent framerate (contains screenshot of the running sketch)


I’ve been working with this issue for a while and now it’s driving me crazy. Basically when I run my sketch in fullscreen using P2D render (some shaders work going on) I get a framerate cap at 30 fps no matter what. If my VS Code window is on top with no opacity (using an extension called GlassIt-VSC) I get a framerate boost up to 36-37 frames. For me could be perfectly fine even if the framerate would stay stable at 30 fps, but the worst part is that completely random, when the running sketch is the window on top, gets lower to 20 fps and stays capped on 20 until I alt+tab in and out and gets again capped to 30. Can someone explain me this behaviour? I think this could be a problem related to Processing and NVDIA settings conflicting in some way. For instance, using frameRate() function to cap/uncap a certaing fps target doesn’t help.

I’ll attach a screenshot where you can see my sketch at 36 fps so you get an idea of what I’m talking about, thanks in advance.