acamposuribe / p5.brush

Unlock custom brushes, natural fill effects and intuitive hatching in p5.js
https://p5-brush.cargo.site/
MIT License
453 stars 26 forks source link

Installation issue #37

Closed JeffreyArts closed 4 hours ago

JeffreyArts commented 4 hours ago

I just downloaded the repo as a *.zip file, and included 'dist/p5.brush.js' in my project like this:

    <script src="libraries/p5.min.js"></script>
    <script src="libraries/p5.brush.js"></script>

This throws me the error: Uncaught (in promise) TypeError: s._renderer.uMVMatrix is undefined

This problem will go away when I switch the order of the two file inclusions.


Steps to reproduce this error;

  1. Create a new P5 project with the VSCode Create p5 project command (https://p5js.org/tutorials/setting-up-your-environment/#using-vs-code)[A plug-in recommended by P5]
  2. Download the repo as *.zip
  3. Copy 'dist/p5.brush.js' into 'libraries' directory
  4. Update index.html by adding the following line: <script src="libraries/p5.brush.js"></script> after the inclusion of the p5.min.js file
JeffreyArts commented 4 hours ago

Since this problem will go away when I switch the order of the two file inclusions. I'll close this issue immediately. Just so it can be used as a future reference for others that encounter the same problem

JeffreyArts commented 4 hours ago

Correction, this is not resolved. Cause while the error disappears, it seems as this way p5.brush can't utilise p5. The default rect() method works fine, but replacing it with brush.rect() throws an error.

Uncaught TypeError: s is undefined

brush.fill("#f00", 75); will also throw an error: Uncaught TypeError: s._renderer.uMVMatrix is undefined

acamposuribe commented 4 hours ago

Hi. The library needs to be updated to work with the last version of p5 Another cobtributor already identified the problem. Will fix it asap. Meanwhile, you can try using p5.js 1.9

JeffreyArts commented 4 hours ago

I've tried p5.js version 1.8, 1.9 & 1.11.

1.9 & 1.11 give errors as described above.

1.8 gives its own error: Uncaught Error: createShader() is only supported in WEBGL mode. If you'd like to use 3D graphics and WebGL, see https://p5js.org/examples/form-3d-primitives.html for more information.

edit Haven't tried updating the settings so it uses WebGL yet

acamposuribe commented 4 hours ago

You need to create your sketch in webgl mode. https://p5js.org/reference/p5/createCanvas/

JeffreyArts commented 4 hours ago

Thank you for your time, copied one of the demos and got that to work. So now time to get my hands dirty and explore this wonderful new library 😄

acamposuribe commented 4 hours ago

Thank you for testing and using the lib! Hope you enjoy