beginShape()

Shape / Vertex

Description

Using beginShape() and endShape() allows creating complex forms. Optionally pass a shape kind.

Syntax

void beginShape() void beginShape(int kind)

Parameters

NameTypeDescription
kindintPOINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, QUAD_STRIP (optional)

Returns

void

Related

Under the Hood

From Processing.h:

void beginShape(); void beginShape(int k=-1) { kind=k; verts.clear(); } void beginShape(int kind=-1); inline void PGraphics::beginShape() { if(PApplet::g_papplet) PApplet::g_papplet->beginShape(); }

Under the Hood

From Processing.cpp:

void PApplet::beginShape(int kind){ shapeKind = kind; inShape = true; shape3D = false; shapeVerts.clear(); shapeVerts3D.clear(); // Vertices are always collected in shapeVerts / shapeVerts3D. // endShape() draws fill and/or stroke from those collections. // shape3D is set when 3-component vertices are used (vertex(x,y,z)). }