Category: 2D Overlay
Syntax:
b2dDrawQuad:Void(x1:Int, y1:Int, x2:Int, y2:Int, x3:Int, y3:Int, x4:Int, y4:Int, fill:Int)
Void
Draws an arbitrary four-cornered polygon from four points.
Takes the four corners in order, (x1,y1) -> (x2,y2) -> (x3,y3) -> (x4,y4),
and fill (0 = outline only, non-zero = filled solid).
Returns nothing.
Unlike b2dDrawRect this is not axis-aligned, which is the point: a 3D face,
once projected onto the screen, is a wonky quadrilateral, and so is the road
surface in a pseudo-3D racer. It is the building block for flat-shaded polygon
rendering. A triangle is just a quad with two coincident points.
A filled quad is two triangles fanned from the first point - (1,2,3) and
(1,3,4) - so the order of the points matters for a self-intersecting shape.
There is no backface culling: the points may wind either way and the quad
still draws, because a projected face arrives in either winding and the program
decides its own shading.
It is an ordinary primitive. It honours the current colour and alpha, takes part
in the clip rect (b2dSetClipRect) and the depth buffer (b2dSetDepth), and batches
with lines, rects and circles in draw order.
View detailed documentation online
b2dSetColor(200, 180, 60) b2dDrawQuad(100,100, 200,120, 190,220, 90,200, 1)
BambooBasic © 2026 Michael Denathorn