I exhibited this interactive, abstract painting generator at the Nuit Blanche in London, Ontario, on the evening of the 18th June. More information and pictures at my blog:
http://gileswhitaker.wordpress.com/
I also have a question about improving this work in the programming forum.
I have a sketch which is doing some pretty heavy calculations every frame. and thus is only updating at about 5fps. I Don't mind this, as it works with the graphics and gives it a slow, meditative feel. However, I also have mouseclicked and mousedragged methods that allow the user to draw on the screen - and what they draw is then subjected to the same evolutionary process as everything else on the screen. (this work was exhibited - see
http://forum.processing.org/topic/vision-persist-at-nuit-blanche-london-ontario#25080000001006583)
Am I right in thinking that all the mouse events are queued up and only processed once very draw() loop? The problem is that the user's drawing isn't very smooth - it only seems to update at the same framerate that the sketch is running at.
I was wondering if there was any way I could make the drawing update the screen as it happens - without having to wait for the end of the draw loop. The processing of the evolution of the picture would still take place slowly, but drawing would be processed "instantly". Perhaps using threads?
The basic structure of the program is:
class square()
{
//a square is just a square of a particular size, position, and colour - with methods to set the colour and draw itself
square() {//constructor}
render(){//draw the square}
}
float xsize=400;
float ysize=320;
square[][] grid= new square[(int)xsize][(int)ysize];
void setup()
{
//set up all the parameters, etc
}
void draw()
{
iterate through the grid of squares, blending their colours together in a certain way to create a constant evolution, then draw all the squares
}
void mousePressed()
{
tempcol=color(random(255), random(255), random(255)); //set a random drawing colour when the mouse is pressed
}
void mouseClicked() //draw a single square at the click point
{
tempcol=color(random(255), random(255), random(255));
grid[(int)(mouseX/squarewidth)][(int)(mouseY/squareheight)].col= tempcol;
grid[(int)(mouseX/squarewidth)][(int)(mouseY/squareheight)].render();
}
void mouseDragged() //draw squares along the dragging path
{
if (mouseX>0 && mouseY>0 && mouseX<width && mouseY<height)
{
grid[(int)(mouseX/squarewidth)][(int)(mouseY/squareheight)].col= tempcol;
grid[(int)(mouseX/squarewidth)][(int)(mouseY/squareheight)].render();
}
}
So draw() is constantly blending and redrawing the grid of squares, but you can click and drag to draw squares of a random colour at the same time. A new random colour is chosen every time you click the mouse down.
Any ideas about how to make the mouse stuff happen faster than the draw loop would be most welcome. I'm happy to post the whole program if people are interested - but it is quite complex, and the essential information is in the summary above.
Hi there.... I'm making a Boggle solver... (just for fun - there's plenty of them around already).
The first step was to write a program where you could just enter the word in a text field and the program would check to see if it is in the dictionary. The dictionary I am using is the SOWPODS official scrabble dictionary which I have as a text file. I decided to use a binary search algorithm - found one on the net and adapted it. I am using G4P for the text field and buttons. The program will just not find any words though. I even replaced the binary search algorithm with a simple sequential one (both are in the program) - still indicates the word is not found. I set up a printwriter to print the word read from the textfield to a file to check nothing weird was happening to it - seemed fine. Well, I'm stumped....
To run this you will need to create a textfile with some words in it, called "sowpods.txt". You will also need the G4P library installed. If you can spot anything obvious that would be great!
/* void keyPressed() { if(key=='Q') { output.flush(); // Writes the remaining data to the file output.close(); // Finishes the file exit(); // Stops the program } } */
Aarrgh. I'm kind of embarrassed to be asking this as I've had problems with this in the past. But I just cannot seem to find the right place to put the files for this library. I tried extracting the zip file directly to ../sketchbook/libraries/
I tried moving the jar file directly into this folder. I tried putting it in a bunch of other places. No luck. The annoying thing is that I had it working fine earlier, but I reinstalled some stuff.....
Any help appreciated (I was formerly know as Giles, but that username seems to have vanished in the move).