In my program, image() is called during many of the draw cycles (image() is inside of display_img()). The program draws what it's supposed to on the screen properly if I comment out saveFrame(). But when I try and use saveFrame(), nothing ever changes in the display window, it just remains as one unchanging image (and outputs this one image over and over). I've been Googling like crazy, and no one else seems to have this sort of problem with saveFrame(). Here is my draw function:
void draw()
{
count++;
float diffA = 0;
float diffB = 0;
float diffAnew = 0;
float diffBnew = 0;
//randomly select two tiles
int imgA = int(random(num_tiles));
int imgB = int(random(num_tiles));
//make sure they are not the same tile
while (imgA == imgB)
{
imgB = int(random(num_tiles));
}
//get difference between tile and image under it
diffA = difference(imgA, sect_to_px(imgA));
diffB = difference(imgB, sect_to_px(imgB));
//switch tiles and get difference between tile and image under it
diffAnew = difference(imgA, sect_to_px(imgB));
diffBnew = difference(imgB, sect_to_px(imgA));
//switch tiles if new positions are better
if (((diffA - diffAnew) + (diffB - diffBnew)) > 0)