New Library: Make examples in Processing 2.2.1 or 3?

I am working on a new library to share with the community. The library is done and works fine, I just need to write some documentation and put together the examples.

It seems that with Processing 3, the sketches need to change slightly. The size commands need to be in a separate settings function, which won't get called if the same sketch is run under Processing 2.2.1. So should I make examples for Processing 3 or 2.2.1? Or should there be two versions of the library examples, one for each version? It isn't a big change to the examples and my library works fine as is in both versions.

This might be a library deployment question. I don't want someone to open one of my examples in the wrong version of Processing.


  • In PS3 the size command still works inside the setup method like 2.2.1

  • When I try that I get this message:

    When not using the PDE, size() can only be used inside settings().
    Remove the size() method from setup(), and add the following:
    public void settings() {
      size(500, 500, processing.opengl.PGraphics3D);
    Exception in thread "Animation Thread" java.lang.IllegalStateException: size() cannot be used here, see
    at processing.core.PApplet.insideSettings(
    at processing.core.PApplet.size(
    at art.test.RotatingCube.setup(
    at processing.core.PApplet.handleDraw(
    at processing.awt.PSurfaceAWT$12.callDraw(
    at processing.core.PSurfaceNone$
  • Answer ✓

    OK are you running an exported app or perhaps using Eclipse?

  • Actually, you are right:

    The settings() function is new with Processing 3.0. It's not needed in most sketches. It's only useful when it's necessary to define the parameters to size() with a variable or to load that information from a file. Alternately, the settings() function is necessary when using Processing code outside of the Processing Development Environment (PDE). For example, when using the Eclipse code editor, it's necessary to use settings() to define the size() and smooth() values for a sketch..

    I can't run Processing 3 through the Processing IDE, only through Eclipse. According to the documentation, what I see is Eclipse only.

    So that answers my question. Thanks!

Sign In or Register to comment.