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
テクスチャマッピングのモード(座標空間)を設定します。
| 引数名 | 内容 | 備考 | オプション | デフォルト値 |
|---|---|---|---|---|
| mode | モード | IMAGE : 実座標空間 NORMAL : 正規化された座標空間(0~1の範囲) |
なし
・デフォルトのモードは「IMAGE」です。