Skip to content

[p5.js 2.0+ Bug Report]: p5.strands can't finalColor.set(c) for passed uniformVec4 #8779

@nbogie

Description

@nbogie

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.2.3

Web browser and version

chrome

Operating system

mac

Steps to reproduce this

Steps:

  1. run https://editor.p5js.org/neill0/sketches/dfBPlTGnb
  2. observe error:

"An error occurred compiling the fragment shader: ERROR: 0:321: 'HOOK_getFinalColor' : Function does not return a value"

The generated glsl is:

vec4 HOOK_getFinalColor(vec4 color) {
}

Snippet:

set a 4-element array with setUniform

myShader = buildMaterialShader(prepShader);
shader(myShader);
myShader.setUniform("c", [1, 0, 0, 1]);

then in the shader setup, trying to pass it straight to .set() doesn't work

  let c = uniformVec4("c");
  finalColor.begin();
  finalColor.set(c);
  finalColor.end();
}

...but this would work:

  let c = uniformVec4("c");
  finalColor.begin();
  finalColor.set(c.xyzw);
  //or
  // finalColor.set([c.x, c.y, c.z, c.w]);
  finalColor.end();
}

(We get the same for filterShader's filterColor.set())

I'm just reporting. I don't think I can work on this.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Completed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions