Sha256: ec2728f7a38e4fe3d4cd5be793a7dbc1a3db849bb964b1dbbbdbd269f9e64c6b

Contents?: true

Size: 925 Bytes

Versions: 3

Compression:

Stored size: 925 Bytes

Contents

# Description:
# This full-screen demo can demonstrate the kinds of speedups 
# that are possible with OpenGL-accelerated rendering. If you
# have the OpenGL library installed, you'll get *much* 
# smoother and faster drawing.

require 'ruby-processing'

class FullScreen < Processing::App
  load_library :opengl
  
  def setup
    library_loaded?(:opengl) ? render_mode(OPENGL) : render_mode(P3D)
    no_stroke
  end
  
  def draw
    lights
    background 0
    fill 120, 160, 220
    (width/100).times do |x|
      (height/100).times do |y|
        new_x, new_y = x * 100, y * 100
        push_matrix
        translate new_x + 50, new_y + 50
        rotate_y(((mouse_x.to_f + new_x) / width) * Math::PI)
        rotate_x(((mouse_y.to_f + new_y) / height) * Math::PI)
        box 90
        pop_matrix
      end
    end
  end
end

FullScreen.new(:full_screen => true, :title => "Full Screen", :width => 600, :height => 600)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-processing-1.0.1 samples/full_screen.rb
ruby-processing-1.0.2 samples/full_screen.rb
ruby-processing-1.0.3 samples/full_screen.rb