Avoid unnecessary texture copies and fix flipped webcams in WebGL#8572
Open
davepagurek wants to merge 1 commit intodev-2.0from
Open
Avoid unnecessary texture copies and fix flipped webcams in WebGL#8572davepagurek wants to merge 1 commit intodev-2.0from
davepagurek wants to merge 1 commit intodev-2.0from
Conversation
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.
Resolves #8571
Changes
_ensureCanvasin WebGL when dealing with a flippedcreateCapture, regular videos do not need thiscreateCapture, it now actually uses the.canvasproperty (which is flipped) instead of the.eltproperty (which is not)_checkIfTextureNeedsUpdatemethod that gets called instead, which does only the necessary parts of_ensureCanvasfor WebGL: marking the texture as needing updating if the time has changed and the video feed needs an update.Screenshots of the change
Live: https://editor.p5js.org/davepagurek/sketches/IaCx_pKPE
The test sketch has a flag to toggle between testing webcam feeds and video files. There's an additional flag to toggle between drawing the textures to the canvas and showing them as HTML elements. I've manually tested all combinations of these for perf and correctness.
Note that the flipped webcam feed still has slightly worse perf due to it requiring the extra canvas draw.
PR Checklist
npm run lintpasses