clip()

Rendering

Description

Limits the rendering to a rectangular area. Only pixels inside the clip region will be drawn.

Syntax

void clip(float x, float y, float w, float h)

Parameters

NameTypeDescription
xfloatx-coordinate
yfloaty-coordinate
wfloatwidth of clip region
hfloatheight of clip region

Returns

void

Related

Under the Hood

From Processing.h:

void clip(float x, float y, float w, float h);

Under the Hood

From Processing.cpp:

void PApplet::clip(float x, float y, float w, float h) { // Scissor coordinates are in GL space (Y=0 at bottom), so flip Y glEnable(GL_SCISSOR_TEST); glScissor((int)x, winHeight - (int)(y + h), (int)w, (int)h); }