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 & HelpPrograms › ArrayIndexOutOfBoundsException
Page Index Toggle Pages: 1
ArrayIndexOutOfBoundsException (Read 2036 times)
ArrayIndexOutOfBoundsException
Aug 5th, 2005, 9:33pm
 
hey p5ers

i hope this is in the right forum.

i keep getting this error:

Code:

java.lang.ArrayIndexOutOfBoundsException: 480733

at processing.core.PLine.drawLine_plain_alpha_spatial(PLine.java:796)

at processing.core.PLine.draw(PLine.java:407)

at processing.core.PGraphics3.render_lines(PGraphics3.java:1480)

at processing.core.PGraphics3.endShape(PGraphics3.java:1130)

at processing.core.PGraphics3.box(PGraphics3.java:2373)

at processing.core.PGraphics3.box(PGraphics3.java:2313)

at processing.core.PApplet.box(PApplet.java:5885)

at Temporary_221_4173$Mark.drawMe(Temporary_221_4173.java:193)

at Temporary_221_4173$Mark.update(Temporary_221_4173.java:180)

at Temporary_221_4173.draw(Temporary_221_4173.java:106)

at processing.core.PApplet.display(PApplet.java:1116)

at processing.core.PGraphics.requestDisplay(PGraphics.java:362)

at processing.core.PApplet.run(PApplet.java:951)

at java.lang.Thread.run(Unknown Source)


it seems to happen at random, always on a call to box().  my sketch is 800x600, so 480733 is just about one line outside of that range (it's always some number around that value).  i am using pixels[] to do some fading stuff.  this error isn't happening during my access of that array, though.

does anyone know why this happens + how to stop it?

thanks,
jake
Re: ArrayIndexOutOfBoundsException
Reply #1 - Aug 6th, 2005, 3:54pm
 
how about a small bit of code that shows the problem? if you can give a really short example, then it's easier to track down what's going on.
Re: ArrayIndexOutOfBoundsException
Reply #2 - Aug 6th, 2005, 6:40pm
 
this is as small as i was able to get this sketch:

Code:

int numMarks = 25;
float gz=1.0;

void setup() {
size(800,600,P3D);
framerate(30);
background(255);
noFill();
stroke(0,0,0,15);
}

void draw() {
gz *= 1.5;

println("gz " + gz);

scale(gz);
for(int i=0; i<numMarks; i++) {

//pushMatrix();
box(205);
//popMatrix();
}
}


seems like it dies when the scale() argument gets too high (16,000 or so, probably way to high).  in my original sketch, however, this crash will still happen eventually even at a scale of 5.

thanks!
jake
Re: ArrayIndexOutOfBoundsException
Reply #3 - Aug 6th, 2005, 10:14pm
 
Can you please show your sketch too? The rest of it? Since you're saying it crashes at scale of 5 that doesn't sound normal...
Re: ArrayIndexOutOfBoundsException
Reply #4 - Aug 7th, 2005, 4:43am
 
sure; it's at:
http://structuredsound.net/jake/draw_1.pde

i hope that helps even though it's pretty messy.

thanks,
jake
Page Index Toggle Pages: 1