Sunday, October 25, 2015

Processing and Maven - take 2

It's been almost a year since I wrote a guide to setup processing using maven. This year, the guys at processing released their needed 3.0 version that leaves AWT behind and all applet related stuff, so I decided to update the tutorial for you to use the latest stuff.
If you don't know what processing is, it's an amazing Java project that allows you to work with visual arts. It's a really simple and powerful engine for doing multimedia stuff.

Maven

Yesterday, I took the latest stable version of processing (3.0.1), mavenized it and put it online so you can use processing in your projects with your IDE of choice

Declare this pom property
Add this third party repo to your pom:
And these dependencies:
You will need at least processing core that contains the processing classes.
If you want 3D (OpenGL support) you will need gluegen and jogl-all dependencies, with their native binaries. See the following list to pick the best for you according to your hardware(I used natives-windows-amd64 in my case)

Native libraries classifier

  • MacOS
    • natives-macosx-universal
  • Windows
    • natives-windows-amd64
    • natives-windows-i586
  • Linux
    • natives-linux-amd64
    • natives-linux-i586
    • natives-linux-armv6hf

Example Script

After creating the project and setting up the pom file you can create a class like this one:
Notice that some of the code has changed to be processing 3.0 compatible

This should give you a nice spinning 3D cube:


If you have any errors (specially with 3d stuff), check that you have the correct drivers, that you are not inside a virtual box (there's an issue for their 3d support), and if everything fails, check the web for common errors