Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createFilterShader throws an error in 2D mode #6520

Closed
1 of 17 tasks
davepagurek opened this issue Nov 2, 2023 · 3 comments
Closed
1 of 17 tasks

createFilterShader throws an error in 2D mode #6520

davepagurek opened this issue Nov 2, 2023 · 3 comments

Comments

@davepagurek
Copy link
Contributor

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build Process
  • Unit Testing
  • Internalization
  • Friendly Errors
  • Other (specify if possible)

p5.js version

1.8.0

Web browser and version

Firefox 117

Operating System

macOS 14

Steps to reproduce this

Steps:

  1. Create a sketch in 2D mode
  2. Create a filter shader with createFilterShader

You get an error about only being able to do this in WebGL mode.

This is because initially, we were thinking of letting createFilterShader be a way to make custom shaders that can be used in general, not just in filter. However, since #6482, we auto-bind these to the filter graphic anyway.

I propose that we:

  1. take out this error so that even 2D users can use custom filter shaders that people make
  2. add a separate method (createCustomFragmentShader?) to create a normal shader using a default vertex shader
@SableRaf
Copy link
Contributor

SableRaf commented Nov 3, 2023

Hey @davepagurek. This may be a silly question but is there a reason we can't have the createShader() and loadShader() functions also accept a frag shader as a single argument and automatically call something like your proposed createCustomFragmentShader function internally?

@davepagurek
Copy link
Contributor Author

That's not a silly question, I think making create/loadShader also accept just a fragment shader would also work for (2)!

Initially I was thinking that one reason why we might want to have a separate name mentioning a fragment shader is so that we could potentially do the reverse as well, and have another method where you only specify a custom vertex shader (e.g. for this https://openprocessing.org/sketch/1934027) but that's a less common use case, and may be covered better by a more versatile API like #6144.

@davepagurek
Copy link
Contributor Author

This is closed now thanks to #6559!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants