Bug 369 : ArrayIndexOutOfBoundsException in P3D inside defaults/background/clear
Last modified: 2008-06-11 07:31




Status:
RESOLVED
Resolution:
DUPLICATE of bug 511
Priority:
P2
Severity:
normal

 

Reporter:
Curved
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2006-07-07 13:45
When I try to run a program at 800x600 (or other relatively high
resolutions), the program crashes with an ArrayIndexOutOfBoundsException on
the first call of background(). I am unable to test with opengl because of
a lack

As an example, the RGB Cube example at 800x600:

float xmag, ymag = 0;
float newXmag, newYmag = 0;

void setup()
{
size(800, 600, P3D);
noStroke();
colorMode(RGB, 1);
}

void draw()
{
background(0.5, 0.5, 0.45);

pushMatrix();

translate(width/2, height/2, -30);

newXmag = mouseX/float(width) * TWO_PI;
newYmag = mouseY/float(height) * TWO_PI;

float diff = xmag-newXmag;
if (abs(diff) > 0.01) { xmag -= diff/4.0; }

diff = ymag-newYmag;
if (abs(diff) > 0.01) { ymag -= diff/4.0; }

rotateX(-ymag);
rotateY(-xmag);

scale(50);
beginShape(QUADS);

fill(0, 1, 1); vertex(-1, 1, 1);
fill(1, 1, 1); vertex( 1, 1, 1);
fill(1, 0, 1); vertex( 1, -1, 1);
fill(0, 0, 1); vertex(-1, -1, 1);

fill(1, 1, 1); vertex( 1, 1, 1);
fill(1, 1, 0); vertex( 1, 1, -1);
fill(1, 0, 0); vertex( 1, -1, -1);
fill(1, 0, 1); vertex( 1, -1, 1);

fill(1, 1, 0); vertex( 1, 1, -1);
fill(0, 1, 0); vertex(-1, 1, -1);
fill(0, 0, 0); vertex(-1, -1, -1);
fill(1, 0, 0); vertex( 1, -1, -1);

fill(0, 1, 0); vertex(-1, 1, -1);
fill(0, 1, 1); vertex(-1, 1, 1);
fill(0, 0, 1); vertex(-1, -1, 1);
fill(0, 0, 0); vertex(-1, -1, -1);

fill(0, 1, 0); vertex(-1, 1, -1);
fill(1, 1, 0); vertex( 1, 1, -1);
fill(1, 1, 1); vertex( 1, 1, 1);
fill(0, 1, 1); vertex(-1, 1, 1);

fill(0, 0, 0); vertex(-1, -1, -1);
fill(1, 0, 0); vertex( 1, -1, -1);
fill(1, 0, 1); vertex( 1, -1, 1);
fill(0, 0, 1); vertex(-1, -1, 1);

endShape();

popMatrix();
}
Additional Comment #1 From Curved 2006-07-12 09:20
"I am unable to test with opengl because of a lack..." of a 64 bit JOGL
distrobution :)
Additional Comment #2 From Curved 2006-07-12 09:23
... using Java 1.4.2
Additional Comment #3 From fry 2006-07-12 09:25
this is a general problem with thread synchronization and how P3D is
allocated.. i've run into it before but i don't think it's officially
logged in the bugs db, so now it is, thanks.

it's of reasonable importance to get it tracked down, it seems to
especially be a problem with the linux JVMs.
Additional Comment #4 From fry 2006-08-02 13:28
found and fixed for 0116. the problem was when the component was being
resized in the midst of a draw() method. the linux jvm seems to be more
prone to this, perhaps because of the placement weirdness described in bug
#341
.

this may also fix bug #367.
Additional Comment #5 From fry 2006-08-16 08:16
*** Bug 384 has been marked as a duplicate of this bug. ***
Additional Comment #6 From fry 2006-09-28 14:43
ran into last-minute problems with this fix and had to remove it for 0116.
will have to revisit for the next release.
Additional Comment #7 From fry 2008-06-11 07:31
still probably an occasional (though infrequent) problem.. will be fixed
along with bug #511.

*** This bug has been marked as a duplicate of 511 ***