Chapter 18 - Graphical Programming #
Let’s start in a way that’s incredibly simple, and abstract away all the hard stuff at first by using a tool kit called ‘Processing’, which is available under that name from the community repo in arch. The default IDE that comes with it is awful to work in though, so go ahead and open up VSCode and grab the Processing Language add on, then in VSCode open up a new workspace folder and make a file called processing.pde, then open VSCode’s command pallete (CTRL+Shift+P) and run ‘Processing: create task file’, after that you’ll want to open the tasks.json file and change the
command: line to have
"command": "/usr/bin/processing-java", after that you can easily try new code just by re-building project the project with CTRL+Shift+B
Alright, setup out of the way, let’s code! One of my first projects in processing was to make a Topographic Map, looking generator because I just find them quite visually appealing.
So, thinking about that problem, we clearly need data. Probably an array of sorts with a bunch of values that have a smoothed relationship when viewing them as a height map, then we’d want to look at the transition points between ranges of values.
Looking up random data generation in python, and you should stumble upon its noise generation, and see that it uses Perlin Noise, which upon looking at it should be obvious that it generates exactly what we want. So, looking up an example for that in processing, we get to this page: https://processing.org/examples/noise2d.html
Well, that’s already super close, so let’s look at that code
Alright, so line by line, it seems that line 1 is just defining a constant. Reading the Processing docs, you’ll find setup() should contain size() which takes two arguments that are the size of the output window in pixels (x and y) and that draw() is an endlessly looping function that updates that window.
Before going further, let’s copy and paste the code into VSCode and run it:
[TODO] add picture
C++ from scratch, JS electron app, Processing creative coding, Python Kivy or similar, Flutter (google lang), shaders (graphical editors), nimp, ronin, Nuklear
26 video playlist from Aaron Lanterman, a Georgia Tech professor