Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix WebGL vertex property issue #7605

Closed

Conversation

ImRAJAS-SAMSE
Copy link
Contributor

@ImRAJAS-SAMSE ImRAJAS-SAMSE commented Mar 6, 2025

Resolves #7519

Changes:

  • Fixed the WebGL vertex property issue in dev-2.0 branch.

PR Checklist

allcontributors bot and others added 30 commits January 20, 2025 15:48
docs: add thrly as a contributor for doc, and code
docs: add lirenjie95 as a contributor for doc, and code
docs: add philyawj as a contributor for doc
docs: add akkarn1689 as a contributor for code
docs: add xinemata as a contributor for eventOrganizing, tutorial, and 3 more
…at2244

docs: add Vaivaswat2244 as a contributor for code
docs: add dkessner as a contributor for example
…Sinha1309

docs: add AnimeshSinha1309 as a contributor for example
for (const { point, dir, color } of potentialCaps.values()) {
this._addCap(point, dir, color);
this._addCap(point, dir, color);
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to how functions like addCap, addSegment, etc copy the positions and colors into new buffers, I think we'd have to do the same for vertex properties. The reason for this is that while the data is initially recorded per point on the line, those points then get turned into triangles to give the line thickness, so we end up having to repeat the data a few times for each point in the triangle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll update the implementation

@davepagurek
Copy link
Contributor

Could you explain a bit what the the projectionMatrix, viewMatrix, and modelMatrix changes are? I didn't see code in the Files Changed tab relating to those at first glance.

Fix endShape() to Properly Close Paths and Prevent Shape Merging
@ImRAJAS-SAMSE
Copy link
Contributor Author

You're right, I mistakenly mentioned those matrices in the PR description, but they weren’t actually changed. The focus of this PR is fixing the WebGL vertex property issue. I'll update the description. Thanks for pointing it out!

And for now I’ll update the implementation to copy vertex properties into new buffers, similar to how addCap and addSegment handle positions and colors.

@ImRAJAS-SAMSE
Copy link
Contributor Author

hey @davepagurek i've updated the pr. The issue with vertex properties has been resolved, and manual testing confirms the fix.

@ImRAJAS-SAMSE
Copy link
Contributor Author

Hey @davepagurek, just checking in—let me know if any further changes are needed. Thanks!


// Copy vertex properties into buffers for stroke vertices
if (this.vertexProperties) {
this.vertexProperties.push([...this.vertexProperties[currEdge[0]]]);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we might need to do this more than once, depending on what we add. So I think every edge has 4 vertices (we render segments as rectangles basically), so we'd have to double these up. But also, between some segments we have quads for joins, and at some segments we also have caps, and all of the vertices for those need vertex properties too, otherwise we won't have enough data to match all the vertices.

_addCap, _addJoin, and _addSegment already do this duplication for positions and colors, so those methods may need to be modified to pass in vertex properties so that they can duplicate and add them too.

@davepagurek
Copy link
Contributor

Hey, sorry for the delay! I may be a little slow to reply in the next few weeks as we finalize the initial p5 2.0 release, so I appreciate you pinging me to remind me 🙂 I left a comment about how we might be able to handle the extra vertices in caps, joins, etc, let me know if that makes sense!

@ImRAJAS-SAMSE
Copy link
Contributor Author

Hey @davepagurek, thanks for the feedback! I’ll ensure that vertex properties are properly handled in _addCap, _addJoin, and _addSegment and update you accordingly. Appreciate your time, and best wishes as you finalize the p5 2.0 release!

@ImRAJAS-SAMSE ImRAJAS-SAMSE force-pushed the fix-vertexProperty-stroke branch from b6491c2 to 4496a4d Compare March 16, 2025 05:30
@ImRAJAS-SAMSE ImRAJAS-SAMSE closed this by deleting the head repository Mar 16, 2025
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.

6 participants