We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Exporting an applet
Page Index Toggle Pages: 1
Exporting an applet (Read 372 times)
Exporting an applet
Dec 20th, 2008, 12:10am
 
Hi there

I am just in the processing putting the finishing touches to two processing programs and want to upload them to the openprocessing site. I have exported them and all looks fine, I get a folder showing me the files etc. However when I test this in Firefox nothing comes on screen. The links to the code work fine etc.

I have created a very simple test (see below) which works fine in processing but when I export and view index.html in Firefox I don't see the ellipse? Any suggestions?

I am running this under Fedora, standard build, 9. I have corrected the preferences.txt issue as well.
void setup()
{
 size(640, 400);
 
}

void draw()
{
 fill(0);
 ellipse(10,10,10,10);
}

Re: Exporting an applet
Reply #1 - Dec 20th, 2008, 4:22pm
 
Hi there

I found some interesting things.... I have moved over to Mac. Firstly if I view the code above in Safari I get a result! Not sure on what I need for Firefox to work, guessing OpenGL?

However, I have noticed that I can't specify certain objects based on variable values. Some code below...

int width = 70;
int height = 200;
int zoom = 3;
int gutter = 40;


void setup()
{
 width = width*zoom;
 height = (height*zoom)+gutter;
 size(width, height);
 size(210,640);
}

void draw()
{
  background(255);
  fill(0);
  for (int i = 0; i < 5; i++)
  {
      ellipse(100+(zoom*i),100-(zoom*i),10,10);
  }
}

The ellipse does not show in safari as it does when you run the application on my machine. In fact, the first size(width,height) also does not get recognised through an exported solution.

To confirm, when I export the app, I then browse to the index.html to view the visualisation in Safari.

Anyone seen this? Any suggestions, the code I want to publish has a lot of variables in shapes etc.
Re: Exporting an applet
Reply #2 - Dec 20th, 2008, 5:48pm
 
See size(): "Do not use variables as the parameters to size() command, because it will cause problems when exporting your sketch."
Processing parses the size() command to know what size to specify for the applet.
Re: Exporting an applet
Reply #3 - Dec 21st, 2008, 10:31pm
 
Thanks for that, I admit I had not read that bit. I am learning to code from the book Visualising data. I, however, do apologise for not reading that. Thank you for your post.
Re: Exporting an applet
Reply #4 - Dec 22nd, 2008, 8:48am
 
No problem, everybody is doing the same error, including me at the start: skipping the reference page because the usage seems obvious from the examples, perhaps missing the "fine print", trying to parametrize stuff which is, in general, a good thing to do... Here, it is somehow parametrized, but implicitly, by using Processing's variables width and height.
It is a bit limiting (eg. when we need to enforce a ratio, to add a margin like I saw once, etc.) but the feature (extracting the values) is useful and hard to impossible to do otherwise.
Page Index Toggle Pages: 1