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

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

Merged
merged 3 commits into from Feb 7, 2023
Merged

Conversation

leslieyip02
Copy link
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
Copy link

welcome bot commented Jan 28, 2023

🎉 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
Copy link
Contributor

@davepagurek davepagurek left a comment

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!

Copy link
Contributor

@davepagurek davepagurek left a comment

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

@@ -1995,6 +1995,7 @@ p5.RendererGL.prototype.image = function(

this._pInst.noLights();

noStroke();
Copy link
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!

Copy link
Contributor

@davepagurek davepagurek left a comment

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