Frame rate logic in draw -- locating it in the source code

I am trying to track down the code that Processing uses to change the frameRate() into decisions about when to lag or speed up individual frame start times – including where the default frameRate() goal is stored, how it is updated, how it is used, and how the frameRate status variable is updated.

I tried digging around with github search and had problems.

I found the interface for setFrameRate in PSurface, but not where it is being used (by g?).

I also found rendering logic that looks right in the PSurfaceNone.thread class definition for AnimationThread. PSurface is a “Surface that’s not really visible. Used for PDF and friends, or as a base class for other drawing surfaces. It includes the standard rendering loop.” So I am unsure – is this timing code for “PDF and friends” — things with None surfaces – or does this get extended into something used by g?

The only other timing logic I have been able to dig up is in saveTargetAsync in PGraphics, which I’m almost certain is for file saving only – not draw.

Is anyone familiar with the Processing draw loop who can help me identify the right bits of code to inspect for its timing logic?

I believe that FPS logic is pretty much at these lines: :thinking:

1 Like