Skip to content

Commit

Permalink
Update blend example
Browse files Browse the repository at this point in the history
  • Loading branch information
prontopablo committed Feb 3, 2025
1 parent a0cd186 commit c94ec9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/blend/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ function setup() {
createCanvas(600, 600, WEBGL); // Enable WEBGL mode for shaders

blend = createFilterShader(fip.blend); // Load the blend shader

ireland = loadImage("ireland.jpg");
bird = loadImage("bird.jpg");

// Create 2 framebuffers so we can control which textures are sent to the shaders
layer1 = createFramebuffer();
layer2 = createFramebuffer();

Expand All @@ -37,7 +39,8 @@ function draw() {
// Apply the blend shader
filter(blend);

blend.setUniform('texture1', layer1.color); // Blend
// Send our two textures to the shader
blend.setUniform('texture1', layer1.color);
blend.setUniform('texture2', layer2.color);
blend.setUniform("uTextureSize", [width, height]);
blend.setUniform('mixFactor', 0.5);
Expand Down

0 comments on commit c94ec9a

Please sign in to comment.