plugdata-team / plugdata

Pure Data as a plugin, with a new GUI
https://plugdata.org
GNU General Public License v3.0
1.57k stars 66 forks source link

Don't use framebuffer for pdlua, as context changes (when using multi… #1843

Closed alcomposer closed 1 month ago

alcomposer commented 2 months ago

…ple editors) will corrupt the graphics context. Use a command cache to replay the last state if it is needed during repaint. WIP

timothyschoen commented 2 months ago

Unfortunately, I think we can't do this, because there is a multi-layer drawing feature coming to pdlua soon that depends on framebuffers

alcomposer commented 2 months ago

Yeah, I like the idea of having a pass over FBO objects in the main loop.

However I think we need to keep the guiCommandBufferCache code so we can update the state of this on its own timer, then use that when rendering into the FBO (at callback rate)

Eg, timer updates cache 60hz Callback can happen at 60-170hz

alcomposer commented 2 months ago

I have updated this PR to use Framebuffers again, but with them being rendered in the updateFramebuffers canvas function.

The framebuffer is registered when a pdlua graphical object is added, and removed when the SafePointer becomes null.

alcomposer commented 2 months ago

Had to move the updateFramebuffer for lua objects to editor, so it will update when canvas is closed.

timothyschoen commented 1 month ago

Merged changes manually