# Taken from processing discussion board, a little sketch by Amnon Owed # Illustrates use of offscreen image, texture sampling, mouse_pressed?, # load_pixels, displayWidth and displayHeight (do not snake case the last two) SCALE = 5 attr_reader :grid COLOR_RANGE = 16581375 # 255 * 255 * 255 def setup size(displayWidth, displayHeight, P2D) @grid = create_image(width/SCALE, height/SCALE, RGB) g.texture_sampling(2) # 2 = POINT mode sampling end def draw unless mouse_pressed? grid.load_pixels grid.pixels.length.times do |i| grid.pixels[i] = rand(COLOR_RANGE) end grid.update_pixels end image(grid, 0, 0, width, height) frame.set_title("#{frame_rate.to_i}+ fps") end
Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0
Friday, 5 July 2013
Setting texture sampling ruby-processing-2.0
Here is a little pixel manipulation sketch that uses and off screen image for efficiency:-
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
-
▼
2013
(94)
-
▼
July
(8)
- Clobbering archived files in a github repository
- Fibonacci Sphere in Ruby Processing
- A simple ruby-processing paint application
- Using Threads in Ruby-Processing
- Yet Another 10 PRINT sketch in ruby-processing
- Another 10 PRINT sketch translated to ruby-processing
- Minimalist Perlin noise sketch in ruby-processing
- Setting texture sampling ruby-processing-2.0
-
▼
July
(8)
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