Search code examples
processingantialiasingrenderer

Choosing a renderer - difference between default and J2D?


The Processing size() documentation says:

In addition to the default renderer, other renderers are: P2D, P3D, PDF

So what's the difference between Default and J2D?

There used to be JAVA2D, P2D, P3D and OPENGL before v2 and I believe that P3D is now just OPENGL.

This link has some relevant info Life Saving Tips For Processing


Solution

  • There are 4 render modes in Processing 2.0:

    • default ("slow" but very accurate 2D render mode)

    • P2D (OPENGL, faster but less accurate 2D render mode)

    • P3D (OPENGL and well, 3D)

    • PDF (for PDF output)

    default | P2D | P3D

    default P2D P3D

    Code I used to create these images:

    void setup() {
      //size(200, 200);
      //size(200, 200, P2D);
      size(200, 200, P3D);
    }
    
    void draw() {
      background(153);
      strokeWeight(10);
      ellipse(100, 100, 100, 100);
    }
    

    You can find a more detailed explanation including a guide on choosing the right mode at What is P3D?