## # Fish Eye # # This fish-eye shader is useful for dome projection. ## attr_reader :fisheye, :canvas, :use_fish_eye def setup() size(640, 640, P3D) @canvas = create_graphics(width, height, P3D) @fisheye = load_shader("FishEye.glsl") @use_fish_eye = true fisheye.set("aperture", 180.0) end def draw() canvas.begin_draw() canvas.background(0) canvas.stroke(255, 0, 0) (0...width).step(10){ |i| canvas.line(i, 0, i, height)} (0...height).step(10){ |i| canvas.line(0, i, width, i)} canvas.lights() canvas.no_stroke() canvas.translate(mouse_x, mouse_y, 100) canvas.rotate_x(frameCount * 0.01) canvas.rotate_y(frameCount * 0.01) canvas.box(100) canvas.end_draw() shader(fisheye) unless !use_fish_eye image(canvas, 0, 0, width, height) end def mouse_pressed() if (use_fish_eye) @use_fish_eye = false resetShader() else @use_fish_eye = true end end
Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0
Tuesday, 4 December 2012
Fish-eye shader revisited with ruby-processing and processing-2.0
Previously one of the most popular posts (700+ hits) on this blog was my glgraphics post with the fish eye shader. Andres has now incorporated some the shader stuff into processing-2.0, here is essentially the same sketch running in ruby-processing, built with processing-2.0 (which includes built in support for glsl shaders).
Labels:
GLSL shader,
processing-2.0,
ruby-processing
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2012
(26)
-
▼
December
(17)
- Bezier Patch as a VBO (PShape)
- Bezier Patch in ruby-processing
- Rotating Arcs Sketch in Ruby Processing
- Context free sketch in regular ruby processing
- Exporting cf3ruby directly to 'large' pdf
- Context Free Tree in cf3ruby
- New context_free.rb (cf3ruby)
- MeshToVBO conversion ruby-processing
- Fix for ruby-processing context free
- What works what does not and may not
- Retained Shape (FBO) in Ruby Processing
- Creating a Mock Vanilla Processing Distribution
- Landscape shader in ruby-processing
- Fish-eye shader revisited with ruby-processing and...
- PShader Example in ruby-processing
- A 3D-texture example with my hacked ruby-processing
- Testing ruby-processing with processing-2.0
-
▼
December
(17)
About Me
- monkstone
- I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2
No comments:
Post a Comment