perspective()

Lights Camera / Camera

Description

Sets a perspective projection. Simulates natural foreshortening. No args sets default.

Syntax

void perspective() void perspective(float fov, float aspect, float zNear, float zFar)

Parameters

NameTypeDescription
fovfloatfield of view angle in radians
aspectfloatwidth/height ratio
zNearfloatnear clipping plane
zFarfloatfar clipping plane

Returns

void

Related

Under the Hood

From Processing.h:

void perspective(); void perspective(float fov, float aspect, float zNear, float zFar);

Under the Hood

From Processing.cpp:

void PApplet::perspective(){ applyDefaultCamera(); } void PApplet::perspective(float fov, float aspect, float zNear, float zFar) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); glScalef(1,-1,1); _gluPerspective(degrees(fov), aspect, zNear, zFar); applyStandardModelview(); }