Sha256: b2ad916818c48c0cf821a252a62e2aa2b44ed098afc3e778c63fb0847f6badeb

Contents?: true

Size: 588 Bytes

Versions: 10

Compression:

Stored size: 588 Bytes

Contents

# Texture 1. 
# 
# Load an image and draw it onto a quad. The texture() function sets
# the texture image. The vertex() function maps the image to the geometry.


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)
  rotate_z PI/6
  
  begin_shape  
  texture @img  
  vertex(-100, -100, 0, 0, 0)
  vertex(100, -100, 0, @img.width, 0)  
  vertex(100, 100, 0, @img.width, @img.height)  
  vertex(-100, 100, 0, 0, @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/texture1.rb
ruby-processing-2.6.2 samples/processing_app/basics/textures/texture1.rb
ruby-processing-2.6.1 samples/processing_app/basics/textures/texture1.rb
ruby-processing-2.6.0 samples/processing_app/basics/textures/texture1.rb
ruby-processing-2.5.1 samples/processing_app/basics/textures/texture1.rb
ruby-processing-2.5.0 samples/processing_app/basics/textures/texture1.rb
ruby-processing-2.4.4 samples/processing_app/basics/textures/texture1.rb
ruby-processing-2.4.3 samples/processing_app/basics/textures/texture1.rb
ruby-processing-2.4.2 samples/processing_app/basics/textures/texture1.rb
ruby-processing-2.4.1 samples/processing_app/basics/textures/texture1.rb