Rendering modes



Processing has three rendering modes: JAVA2D, P3D, and OPENGL. The mode can be explicitly set as an optional argument within Processing's size() method. For example, to use the P3D rendering mode, you would write: size(200, 200, P3D). The rendering modes control how visual data is rendered, or converted to pixels on the screen.



This applet uses P3D:
To view this content, you need to install Java from java.com



OPENGL mode

P3D mode utilizes a software-based 3D engine, meaning that all the 3D calculations are handled by Java, just as normal 2D calculations are; the 3D math is crunched and converted to 2D data before being sent to the graphics hardware to draw the image to the screen. However, your graphics hardware has the capability to crunch numbers, and in fact can do it much faster than Java. The trick, though, is in communicating directly with the graphics hardware to speed things up. OpenGL is a platform-independent library that functions as an interface between your code and the graphics hardware. OpenGL was developed in 1992 by Silicon Graphics, but is now overseen by a large group of organizations, under the heading OpenGL Architecture Review Board.

To use the OpenGL library in Processing, select Sketch > Import Library > opengl, which adds an import line to your sketch, and then add the OPENGL string as a third argument to the size function call: size (400, 400, OPENGL);:
import processing.opengl.*;

void setup(){
    size(100,100,OPENGL);
}