Skip to content

Conversation

@davepagurek
Copy link
Contributor

Fixes a few bugs:

  • @ksen0 noticed that uniformTexture() no longer worked in the intro to strands tutorial. The issue was that the base type in GLSL is "sampler2D". We previously added a human-readable "texture" alias for this, similar to how we can call uniformVector3() instead of the more GLSL-y uniformVec3() to be more in line with p5 naming. I think this got lost in the refactor because typecasting methods like int(something) would cause issues with texture(...) already being an existing p5 method. Typecasting isn't really necessary for texture types so I've omitted that, and just added the alias for uniformTexture.
  • When looking into this, I noticed that the TS type generation script wasn't adding shared* or varying* methods for p5.strands types. Because these are generated in code and are not documented and are not based on JSON data anywhere, for now it means there's similar logic in the TS type generation script to in p5.strands. I don't love that, but I avoided refactoring that for now to just get things working.

Added some tests:

  • A visual test to make sure uniformTexture() works
  • A TS test based on the p5.strands tutorial. I had to add a @ts-ignore for some of the vector operations since TS doesn't like those on arrays. Maybe in the future we can figure out a better way to do our JS-bending in TS.

@@ -0,0 +1,134 @@
// Based on https://beta.p5js.org/tutorials/intro-to-p5-strands/
Copy link
Member

Choose a reason for hiding this comment

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

Minor: for attribution, please add Title and author: "p5.strands: Introduction to Shaders By Luke Plowden" as URL may not be a permalink

@ksen0 ksen0 merged commit 01e1734 into dev-2.0 Nov 10, 2025
5 checks passed
@ksen0 ksen0 deleted the fix/strands-texture branch November 10, 2025 20:12
@ksen0 ksen0 added this to the 2.1 milestone Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants