processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.13k stars 3.23k forks source link

Add a version of Processing's loadShader() function to p5.js #6852

Open Metamere opened 3 months ago

Metamere commented 3 months ago

Increasing access

It would provide a utility and convenience function. It would allow for a smaller main script, which could make things easier to manage, especially when working in the on-line editor with large shader files.

Most appropriate sub-area of p5.js?

Feature request details

p5.js now has a createFilterShader() function where one can create a filter from just a fragment shader, which needs to be defined in the main script file. It would make sense to provide a loadFilterShader() function to allow for creating a filter shader by loading from a separate file, just like loadShader() provides that utility to accompany the createShader function. It would keep things consistent.

welcome[bot] commented 3 months ago

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!

limzykenneth commented 3 months ago

This is already available here or are you thinking of something else?

davepagurek commented 3 months ago

@limzykenneth I think they're referring to an equivalent of createFilterShader, which does the vertex shader for you and makes sure it's bound to the right WebGL context automatically. We don't have a load* equivalent for that just yet, so it would make sense to me to add it for consistency

Metamere commented 3 months ago

@limzykenneth, @davepagurek, you're both correct. I was trying to help by creating this to address an issue someone else brought up, but I misunderstood and messed it up initially. Hopefully the current version is correct.