Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd GLDevice::set_default_framebuffer() #167
Merged
Conversation
|
Yeah, this is the right fix. Thanks! |
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.
toolness commentedMay 27, 2019
•
edited
Okay, I have no idea if this PR contains the right kind of change for pathfinder, but I figured it'd start a conversation, at least.
Basically, when addressing the problem of dynamically resizing the in-editor Unity player mentioned in https://github.com/pcwalton/pathfinder/issues/147#issuecomment-496015315 (e.g., when the user clicks "play" and then resizes their window), I found that the approach used in Pathfinder's demo code didn't fully work in Unity:
https://github.com/pcwalton/pathfinder/blob/bc713a5181ab7ed90469d054c36f78baed36b306/demo/common/src/lib.rs#L266-L274
Specifically, what happens is that the Pathfinder rendering simply disappears every time I resize the window, though it occasionally/randomly comes back into view. I tried simply re-instantiating the whole
Rendererinstance every time the window is resized, and while it did fix the problem, it was also very slow and made resizing the Unity window quite sluggish.After some diagnosis I noticed that Unity appears to change the current GL framebuffer when the user resizes the window; I think the reason the rendering randomly re-appeared on resize was because eventually Unity would happen to use the same framebuffer ID that I'd initialized the renderer with.
However, I also found that if I'm able to change the
GLDevicethat Pathfinder is using to reflect the new framebuffer ID, everything seems to work fine. There isn't currently a way to do that, however, so this PR adds a simple accessor method that makes it possible. But I'm not sure if this violates encapsulation in some way, or has other consequences that I'm not aware of.For reference, the experimental Unity Plugin code that uses this accessor method is at toolness/pathfinder-unity-fun@39221cf.
@pcwalton do you have thoughts on this?