Skip to content

Fixed line drawing in WebGL when there is a previously defined texture#5982

Merged
davepagurek merged 3 commits into
processing:mainfrom
leslieyip02:main
Feb 7, 2023
Merged

Fixed line drawing in WebGL when there is a previously defined texture#5982
davepagurek merged 3 commits into
processing:mainfrom
leslieyip02:main

Conversation

@leslieyip02

Copy link
Copy Markdown
Contributor

Resolves #5440

Changes:
Removed && this.drawMode !== constants.TEXTURE from calculateStroke.

Screenshots of the change:

Using the example from #5440,

  • Before:

Screenshot 2023-01-28 at 18-21-06 p5 js example

  • After:

Screenshot 2023-01-28 at 18-02-46 p5 js example

PR Checklist

@welcome

welcome Bot commented Jan 28, 2023

Copy link
Copy Markdown

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already. And be sure to add yourself to the list of contributors on the readme page!

@davepagurek
davepagurek self-requested a review January 31, 2023 17:14

@davepagurek davepagurek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for making this change happen! I tested locally, looks good!

@davepagurek davepagurek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh, the tests caught something I didn't test: drawing an image using image() now adds lines. Demo here, try toggling which p5 import in index.html is commented to see how p5 1.5.0 behaves: https://editor.p5js.org/davepagurek/sketches/nbzbYeVbp

I think we probably just need to call noStroke() in the WebGL implementation of image(): https://github.com/processing/p5.js/blob/main/src/webgl/3d_primitives.js#L1998

Comment thread src/webgl/3d_primitives.js Outdated

this._pInst.noLights();

noStroke();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Right now the tests are still failing, I believe it's because we can't call the global noStroke() here in case p5 is running in instance mode. I think calling this._pInst.noStroke() should fix it though!

@davepagurek davepagurek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Awesome, thanks for making those changes!

@davepagurek
davepagurek merged commit 7bd7436 into processing:main Feb 7, 2023
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.

Can't draw a Line in WEBGL Renderer if previously a texture was defined

2 participants