Search code examples
javaprocessing

Why won't the OpenSimplexNoise Processing library work?


I'm trying to use this library called OpenSimplexNoise, made by GitHub user TheCodingTrain. But I immediately discovered that I couldn't use it. I did some digging to try to figure this out on my own, and I discovered that the JAR file and the main folder should have the same name (for example, the library file would be named OpenSimplexName and the JAR file would be OpenSimplexNoise.jar), and the folder the JAR file is in should be called "library." Once I fixed these issues, OpenSimplexNoise appeared in the "Import Library" menu in the "Contributed" section. But once I clicked it, a bunch of code appears:

import japplemenubar.*;
import processing.awt.*;
import processing.core.*;
import processing.data.*;
import processing.event.*;
import processing.javafx.*;
import processing.opengl.*;

along with the error message:

More than one library is competing for this sketch. The import japplemenubar points to multiple libraries: core (C:\Program Files\Processing\processing.3.5.4\core) OpenSimplexNoise (C:\Users**\Documents\Processing\libraries\OpenSimplexNoise). Extra libraries need to be removed before this sketch can be used."

I tried removing japplemenubar, but the same issue appeared with processing.awt, so I tried removing that, but it just kept happening with each different import. I tried deleting it all and just typing "import processing.OpenSimplexNoise.*;", but it said "The import processing.OpenSimplesNoise cannot be resolved."

Does this mean that I'm just doing something wrong, or is this library no longer usable?


Solution

  • I recommend watching/following the videos linked in the README and understanding those:

    The tutorials are how to put organize/compile a basic Processing library from scratch, not how to use library itself.

    It would've been easier if a distribution zip would have been uploaded, but the point is learn how to generate it.

    Downloading the library zip and unzipping in Processing won't work.

    You need to:

    1. (install eclipse if you haven't done so already as part of the video tutorial)
    2. clone / download the project on your computer
    3. Import the project into eclipse: Import project into eclipse
    4. Drag and drop the build.xml file into the Ant panel: Show Ant Panel build.xml Ant view (in my view I've got multiple Processing libraries, you might have just OpenSimplexNoise)
    5. Press the green Play Icon to run the build.

    Initially I ran into this error:

    BUILD FAILED
    /Users/George/Documents/eclipse/OpenSimplexNoise-for-Processing/resources/build.xml:107: The following error occurred while executing this line:
    /Users/George/Documents/eclipse/OpenSimplexNoise-for-Processing/resources/build.xml:141: /Users/George/Desktop/OpenSimplexNoise-for-Processing/lib does not exist.
    

    Instead of trying to debug/fix the xml file I simply made the folder structure it wanted: a desktop folder named OpenSimplexNoise-for-Processing containing a lib folder.

    Smooth sailing after this: BUILD SUCCESSFUL

    Part of the ant build is copying the library to Documents/Processing/libraries so you can simply run the examples from there:

    OpenSimplex example

    FWIW I've uploaded the compiled library here.

    If simply wanted to use noise in Processing the built-in noise() function would do the trick.

    If you want Simplex Noise without compiling Daniel Shiffman's example library you could try toxiclibs and it's toxi.math.noise package (also comes with an example sketch).