processing/p5.js

[p5.js 2.0+ Bug Report]: p5.strands breaks if uniforms have two underscores in them

クローズ

#8,794 opened on 2026/05/13

 (7 件のコメント) (2 件のリアクション) (1 人の担当者)JavaScript (3,178 件のフォーク)batch import
Area:WebGLArea:WebGPUHelp Wantedp5.js 2.0+p5.strands

Repository metrics

Stars
 (20,784 個のスター)
PR merge metrics
 (PR metrics pending)

説明

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • WebGPU
  • p5.strands
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.x

Web browser and version

All

Operating system

All

Steps to reproduce this

Steps:

  1. Create a p5.strands shader
  2. Create a uniform containing two underscores
  3. Use it in the shader

We currently try to make uniform variables in the shader code named the same as the variable in your javascript. However, GLSL doesn't let you have two underscores:

Yikes! An error occurred compiling the vertex shader: ERROR: 0:47: '__val' : identifiers containing two consecutive underscores (__) are reserved as possible future keywords

We would need to rename these internally to not have this issue.

Snippet:

function setup() {
  createCanvas(400, 400, WEBGL);
  const myShader = buildFilterShader(() => {
    const __val = uniformFloat(() => 0.5)
    filterColor.begin()
    filterColor.set([__val, __val, __val, 1])
    filterColor.end()
  })
  filter(myShader)
}

Live: https://editor.p5js.org/davepagurek/sketches/lQtNOhb66

コントリビューターガイド