Sha256: 5089b014bd8bf940a2ad86092808af1331ed81c507ec369ca3186622a6b5d53e

Contents?: true

Size: 491 Bytes

Versions: 6

Compression:

Stored size: 491 Bytes

Contents

#
# Edge Detection
# 
# Change the default shader to apply a simple, custom edge detection filter.
# 
# Press the mouse to switch between the custom and default shader.
#
attr_reader :edges, :img , :enabled


def setup
  size(640, 360, P2D)
  @enabled = true
  @img = load_image('leaves.jpg');      
  @edges = load_shader('edges.glsl')
end

def draw
  shader(edges) if enabled
  image(img, 0, 0)
end

def mousePressed
  @enabled = !enabled
  if (!enabled == true)
    resetShader
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-processing-2.6.3 samples/processing_app/topics/shaders/edge_detect.rb
ruby-processing-2.6.2 samples/processing_app/topics/shaders/edge_detect.rb
ruby-processing-2.6.1 samples/processing_app/topics/shaders/edge_detect.rb
ruby-processing-2.6.0 samples/processing_app/topics/shaders/edge_detect.rb
ruby-processing-2.5.1 samples/processing_app/topics/shaders/edge_detect.rb
ruby-processing-2.5.0 samples/processing_app/topics/shaders/edge_detect.rb