textureMode

def setup
  createCanvas(100, 100, WEBGL)
  @img = loadImage("panda.png")
end

def draw
  texture(@img)
  textureMode(NORMAL)
  shape do
    vertex(-50, -50, 0, 0)
    vertex( 50, -50, 1, 0)
    vertex( 50,  50, 1, 1)
    vertex(-50,  50, 0, 1)
  end
end
def setup
  createCanvas(100, 100, WEBGL)
  @img = loadImage("panda.png")
end

def draw
  texture(@img)
  textureMode(IMAGE)
  shape do
    vertex(-50, -50, 0,          0)
    vertex( 50, -50, @img.width, 0)
    vertex( 50,  50, @img.width, @img.height)
    vertex(-50,  50, 0,          @img.height)
  end
end

p5.jsリファレンス(参考情報)

[p5.js] textureMode

概要

テクスチャマッピングのモード(座標空間)を設定します。

書式

textureMode(mode)

引数

引数名内容備考オプションデフォルト値
modeモードIMAGE : 実座標空間
NORMAL : 正規化された座標空間(0~1の範囲)

戻値

なし

備考

・デフォルトのモードは「IMAGE」です。

関連

texture
textureWrap