processing / processing/p5.js

p5shader - beginShape(POINTS | LINES) ignores custom shaders

Open
#5,129 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:WebGL
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Most appropriate sub-area of p5.js?
  • Accessibility (Web Accessibility)
  • Build tools and processes
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Friendly error system
  • Image
  • IO (Input/Output)
  • Localization
  • Math
  • Unit Testing
  • Typography
  • Utilities
  • WebGL
  • Other (specify if possible)
Details about the bug:
  • p5.js version: 1.2.0
  • Web browser and version: Chrome 89.0.4389.90
  • Operating System: Windows 10 Home Premium
  • Steps to reproduce this: Vertices defined between beginShape(arg) and endShape() with arg = LINES | POINTS are not passed to custom shaders previously loaded and set with loadShader() and shader() functions.

`let theShader;
let mycube = null;
let activeCam;

function preload(){

theShader = loadShader('shader.vert', 'shader.frag');
}

function setup() {
createCanvas(600,600,WEBGL);
angleMode(DEGREES);
activeCam = _createCamera();
activeCam.apply();
mycube = _createCube();
}

function draw() {

shader(theShader);
activeCam.move();
scale(1,-1,1);
background(200)

theShader.setUniform('uSizeFactor', 10.0);
theShader.setUniform('uMorphFactor', math.abs(math.cos(millis() / 1000)));

//noFill();
//noStroke();
mycube.render(); // renders a cube with beginShape() / endShape()
}`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied WebGL sketch and tracing how beginShape(POINTS | LINES), endShape(), loadShader(), and shader() interact when vertices are rendered. Confirm the behavior for both POINTS and LINES, then verify that custom shaders receive those vertices as expected without changing the existing rendering behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.