Sha256: d2c09695b2303c489fdde8a73ae9f58724a23c58730da7d618578951a1a72fe2

Contents?: true

Size: 485 Bytes

Versions: 10

Compression:

Stored size: 485 Bytes

Contents

# Texture 2. 
# 
# Using a rectangular image to map a texture onto a triangle.



def setup
  
  size 640, 360, P3D
  
  @img = load_image "berlin-1.jpg"
  no_stroke
  
end

def draw
  
  background 0    
  translate width/2, height/2    
  rotate_y map( mouse_x, 0, width, -PI, PI )
  
  begin_shape
    
  texture @img
  
  vertex -100, -100, 0, 0, 	    0
  vertex  100,  -40, 0, @img.width,   @img.height/3
  vertex    0,  100, 0, @img.width/2, @img.height
  
  end_shape
  
end
  

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ruby-processing-2.6.3 samples/processing_app/basics/textures/texture2.rb
ruby-processing-2.6.2 samples/processing_app/basics/textures/texture2.rb
ruby-processing-2.6.1 samples/processing_app/basics/textures/texture2.rb
ruby-processing-2.6.0 samples/processing_app/basics/textures/texture2.rb
ruby-processing-2.5.1 samples/processing_app/basics/textures/texture2.rb
ruby-processing-2.5.0 samples/processing_app/basics/textures/texture2.rb
ruby-processing-2.4.4 samples/processing_app/basics/textures/texture2.rb
ruby-processing-2.4.3 samples/processing_app/basics/textures/texture2.rb
ruby-processing-2.4.2 samples/processing_app/basics/textures/texture2.rb
ruby-processing-2.4.1 samples/processing_app/basics/textures/texture2.rb