-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Shaders aren't applied to things drawn with image() and with texture() #6327
Comments
I think there are 2 best routes to go here based on whether or not this is intended behavior. If this isn't intended behavior we'll have to change it so that those shaders can be overridden, and if it is intended behavior we'll have to add the fact that those shaders can't be overridden to documentation. |
I think you're mixing things here. If you want to pass an image to a shader you should use the shader.setUniform() function. I believe
However, I am seeing some odd behavior in your example when I try to set a shader after calling texture.
In this case I would have thought that the shader function would take over, but it seems like the texture is somehow overriding the shader. If I add a call to fill() between texture and shader, the shader can take over again. Not sure if this is intended, but it does seem a little weird. |
Right now, enabling lights or setting a texture makes p5 try to use a light shader, so if a user shader doesn't meet these requirements, it gets overridden: Lines 525 to 541 in 0ef830d
In the long term, I'd like an easier way of just overwriting e.g. the body of the fragment shader so that one doesn't have to worry about what uniforms are present, and there's some discussion of that here #6144, but in the short term we might want to update that list to include |
I'm not sure whether or not |
@RandomGamingDev shader.setUniform('uSampler', texture); and if your example is just tinting an image you can simply call tint with the color |
Ik u can, but the idea's that this should work too. |
Actually setting the uniform of uSampler didn't work for me, so i just renamed the variable to something else and it worked, any updates on this issue? |
It's an issue with the shaders that originally caused |
Most appropriate sub-area of p5.js?
p5.js version
1.7.0
Web browser and version
115.0.5790.111
Operating System
Windows 10
Steps to reproduce this
Steps:
image()
ortexture()
.Snippet:
Here's the sketch containing the code: https://editor.p5js.org/PotatoBoy/sketches/KRrVBTkjH
The text was updated successfully, but these errors were encountered: