Skip to content

How to implement a custom shader? #28

@jvolker

Description

@jvolker

I'm trying to implement a fade-out effect of a masked image. Seems like I have a precision problem with the textures trying to get a slow fade effect. Now I found this library :) and like to implement it with my code: https://editor.p5js.org/jvolker/sketches/dqMQVI6Fl

I'm stuck with adapting the floating-point texture example: https://editor.p5js.org/jvolker/sketches/1cpxckP_- to my code. How to apply custom shaders with this FBO library? I couldn't find an example.

As soon as I write

fbo.draw(() => {
    shader(theShader);
    //rect(0,0,width, height);
  }) 

I get TypeError: Cannot read properties of undefined (reading 'width').

For reference, I've previously posted in the p5 forum:
https://discourse.processing.org/t/multiplying-small-numbers-in-shader-causes-strange-behaviour/40949

Thanks a lot in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions