BOX_SIZE = 20 MARGIN = BOX_SIZE * 2 DEPTH = 400 FINT = 3 attr_reader :box_fill, :grid, :fcount, :lastm, :frate def setup size(640, 360, P3D) frame_rate(60) @fcount = 0 @lastm = 0 no_smooth() no_stroke() @grid = create_shape(GROUP) # Build grid using multiple translations (-(DEPTH/2 + MARGIN) ... (DEPTH/2 - MARGIN)).step(BOX_SIZE) do |i| (-(height + MARGIN) ... (height - MARGIN)).step(BOX_SIZE) do |j| (-(width + MARGIN) ... (width - MARGIN)).step(BOX_SIZE) do |k| # Base fill color on counter values, abs function # ensures values stay within legal range @box_fill = color(i.abs.to_i, j.abs.to_i, k.abs.to_i, 50) cube = create_shape(BOX, BOX_SIZE.to_f, BOX_SIZE.to_f, BOX_SIZE.to_f) cube.fill(box_fill) cube.translate(k, j, i) grid.add_child(cube) end end end end def draw background(255) hint(DISABLE_DEPTH_TEST) # Center and spin grid push_matrix() translate(width/2, height/2, -DEPTH) rotate_y(frame_count * 0.01) rotate_x(frame_count * 0.01) shape(grid) pop_matrix() hint(ENABLE_DEPTH_TEST) @fcount += 1 m = millis() if (m - lastm > 1000 * FINT) @frate = fcount / FINT @fcount = 0 @lastm = m puts("fps: #{frate}") end fill(0) text("fps: #{frate}", 10, 20) end
Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0
Wednesday, 5 December 2012
Retained Shape (FBO) in Ruby Processing
Now we are cooking, this example demonstrated running ruby-processing compiled with a pre-released version of processing-2.0b7. Further it demonstrates the use of the FBO to vastly improve performance. All sketches run with this ruby-processing hack are very noisy (complaining about ambigous overloaded java methods eg background and fill).
Labels:
FBO,
processing-2.0,
retained shape,
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