b2dDrawImageQuadUV

Category: 2D Overlay

Syntax:

b2dDrawImageQuadUV:Void(image:Int, x1:Int, y1:Int, u1:Double, v1:Double, x2:Int, y2:Int, u2:Double, v2:Double, x3:Int, y3:Int, u3:Double, v3:Double, x4:Int, y4:Int, u4:Double, v4:Double)


Parameters

Returns

Void



Summary

b2dDrawImageQuad, but instead of always stretching the whole image, each corner says which point of the image it shows. u runs 0 to 1 across the image from left to right and v 0 to 1 from top to bottom, so (0,0) is the image's top-left and (1,1) its bottom-right.

Returns nothing.

Use it to draw part of an image — one cell of a texture atlas, a scrolling window into a larger picture — or to texture a 3D model's faces with their own unwrapped coordinates, which is how a mesh from b2dLoadMesh is drawn.

Passing (0,0) (1,0) (1,1) (0,1) for corners 1 to 4 gives exactly b2dDrawImageQuad. Giving the same UVs to different corners turns or mirrors the image. Values outside 0..1 are not an error: they repeat the image's edge pixels.

Everything else is as for b2dDrawImageQuad: absolute corners with no handle, scale or rotation, colour and alpha apply, split into triangles (1,2,3) and (1,3,4), not depth-tested. Palette-cycling (indexed) images draw nothing. For per-pixel depth use b2dDrawImageQuadDepthUV.

View detailed documentation online



Example
; the top-right quarter of the image, stretched over a 200x200 square
b2dDrawImageQuadUV(img, 100,100, 0.5,0.0,  300,100, 1.0,0.0,  300,300, 1.0,0.5,  100,300, 0.5,0.5)

See examples/Runtime/29 - Image Quads/ImageQuadUV.bam.


BambooBasic © 2026 Michael Denathorn