textureData updated to fix flipping property for webgl #7305
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 #7300
Changes:
https://github.com/processing/p5.js/blob/75c0bfb49dc3202cda0ca847653aae008399a906/src/webgl/p5.Texture.js#L129C7-L132C53
New Check (this.src._ensureCanvas): The update introduces a check for this.src._ensureCanvas. If this method exists, it gets called. This ensures that a canvas is available for the source before proceeding.
New Assignment (this.src.canvas || this.src.elt): Instead of directly using this.src.elt, the code now assigns textureData from this.src.canvas (if available) or defaults to this.src.elt. This allows for the possibility of capturing the canvas representation of the source when necessary, when flipping has to be applied to video or images.
(I wasn't able to commit changes in my old pr and due to some glitch it isn't shown to me so I pulled a new request)