Fix run loop; correctly integrate changes.#36
Merged
catilac merged 1 commit intoprocessing:mainfrom Dec 10, 2025
Merged
Conversation
tychedelia
commented
Dec 10, 2025
| fn run(module: &Bound<'_, PyModule>, draw_fn: Option<Py<PyAny>>) -> PyResult<()> { | ||
| get_graphics_mut(module)?.run(draw_fn) | ||
| loop { | ||
| { |
Member
Author
There was a problem hiding this comment.
This block ensures graphics is dropped after begin_draw but before we call the user's sketch function.
catilac
approved these changes
Dec 10, 2025
Contributor
catilac
left a comment
There was a problem hiding this comment.
YAY it works. So we need to get to make sure the Entity gets dropped every frame?
Noted: Winit
Could you remove the .DS_Store file before merging?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small changes:
runmethod to avoid re-entrancy. This is how I originally had it but wanted to hide it behind a method onGraphics. The problem is that running the user's sketch (i.e.draw.call0) will call back intographics_mutfor any operations, so if we are already holding a mutable borrow inside the run loop, we will blow up when we try to do anything.There's a number of more appropriate fixes. Namely, only
GlfwContextactually need to be mutably accessed through Rust. Everything else could in theory just be&self. This is a broader thing we'll want to consider. I think just switching towinitis probably the right call.Graphicsre: Refactor rendering crate to clarify primary Processing API #34. I just fixed the compile errors but didn't correctly pull out surface into its own object.