P5 Render Modes

P5 Render Modes

七月 01, 2018

Render Modes in Processing

  • N/A
  • JAVA2D(same as N/A)
  • P2D
  • P3D
  • OPENGL(same as P3D)
  • FX2D
  • PDF
  • SVG
  • DXF

Now, we elaborate on each render mode


JAVA2D(same as N/A)

1
2
3
4
5
6
void setup(){
size(500, 500, JAVA2D);
}
void setup(){
size(500, 500);
}

In this mode, P5 uses the AWT module
Renders with CPU
No GPU expense。

Pro:
Support most hardwares;
Little bugs;
Render quality: normal.

Con:
Does not support 3D rendering;
Frame rate is unstable;


P2D

1
2
3
void setup(){
size(500, 500, P2D);
}

In this mode, P5 renders with Java OpenGL(JOGL), has GPU expense;

Pro:
Stable frame rate;
Anti-Aliasing Available;

Con:
Does not support 3D;
Unavailable on some Quadro graphics cards;


P3D(same as OPENGL)

1
2
3
4
5
6
void setup(){
size(500, 500, P3D);
}
void setup(){
size(500, 500, OPENGL);
}

In this mode, P5 renders with Java OpenGL(JOGL), has GPU expense;

Pro:
Support 3D rendering;
Stable frame rate;
Anti-Aliasing Available;
Best Quality;

Con:
Unavailable on some Quadro graphics cards;


FX2D

1
2
3
void setup(){
size(500, 500, FX2D);
}

In this mode, P5 renders with JavaFX, has GPU expense;

Pro:
Best Quality;
Support most platforms;

Con:
Anti-Aliasing Unavailable;
Logic clock rate stable;
Graphics cock rate unstable;


PDF

1
2
3
void setup(){
size(500, 500, PDF, "rect.pdf");
}

or

1
2
3
4
5
6
7
void setup(){
size(500, 500, Java2D/P2D/P3D/FX2D);

beginRecord(PDF, "rect.pdf");
...
endRecord();
}

Save the render result as PDF file;

Pro:
Support vector graphics;

Con:
Has depth test issue;


SVG

1
2
3
void setup(){
size(500, 500, SVG, "rect.svg");
}

or

1
2
3
4
5
6
7
void setup(){
size(500, 500, Java2D/P2D/P3D/FX2D);

beginRecord(SVG, "rect.svg");
...
endRecord();
}

Save the render result as SVG file;

Pro:
Support vector graphics;

Con:
Has depth test issue;


DXF

1
2
3
4
5
6
7
8
9
10
11
void setup(){
size(500, 500, DXF, "rect.dxf");
}

void setup(){
size(500, 500, P2D/P3D/FX2D);

beginRaw(DXF, "rect.dxf");
...
endRaw();
}

In this mode, P5 save the geometry as 3D scene (*.dxf);

Pro:
3D file can be rendered in external 3D software in the upcoming workflow;

Con:
Does not support animation;