Skip to content

Conversation

@tychedelia
Copy link
Member

Changes:

  • Adds some more scaffolding around setting up the implicit graphics context for a sketch.
  • A simple python sketch!

You can see the first commit for an attempt in which we just store the graphics in a TLS just like we do the Bevy App in processing_render. But then I thought, surely there's a way to stash it in the Python runtime itself, right? There is! If you add pass_module to all the wrappers, you get access to the module object itself which is effectively just a GIL controlled map.

I did a bit of research into prior art and this is also what they are doing, i.e. module level _graphics member. The user can theoretically access this if they want, but then all our module fns just forward to that object.

TODO:

@tychedelia tychedelia requested a review from catilac December 9, 2025 08:10
Copy link
Contributor

@catilac catilac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay! I was still trying to figure out more of the details about pyo3, and was about to implement impl From<ProcessingError> which is obviously the wrong direction. I like how you put the Entity and GlfwContext into a class. Thats what I was missing... Thanks!

@catilac catilac merged commit 553ec04 into processing:main Dec 9, 2025
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants