Background Image

Hi,

how can I put a background-image to my world? I tried to put a new body to my world object and bind an image to it, but the image is always in the foreground.
Ok, I loaded an Image with
Code:
backgroundImage= loadImage("surreal1.png");

in my TestBedMain.setup() and put a
Code:

backgroundImage.width=getWidth();
backgroundImage.height=getHeight();
background(backgroundImage);

to my TestbedMain.draw().

Now I get an Error:

Code:
Error while running applet.
java.lang.ArrayIndexOutOfBoundsException
setupjava.lang.ArrayIndexOutOfBoundsException
        at java.lang.System.arraycopy(Native Method)
        at java.lang.System.arraycopy(Native Method)
        at processing.core.PGraphics.background(PGraphics.java:3954)
        at processing.core.PGraphics3D.background(PGraphics3D.java:3833)
        at processing.core.PApplet.background(PApplet.java:8270)
        at org.jbox2d.testbed.TestbedMain.draw(TestbedMain.java:211)
        at processing.core.PGraphics.background(PGraphics.java:3954)
        at processing.core.PApplet.handleDisplay(PApplet.java:1359)
        at processing.core.PGraphics3D.background(PGraphics3D.java:3833)
        at processing.core.PGraphics.requestDisplay(PGraphics.java:680)
        at processing.core.PApplet.background(PApplet.java:8270)
        at processing.core.PApplet.run(PApplet.java:1454)
        at org.jbox2d.testbed.TestbedMain.draw(TestbedMain.java:211)
        at processing.core.PApplet.handleDisplay(PApplet.java:1359)
        at java.lang.Thread.run(Thread.java:662)
        at processing.core.PGraphics.requestDisplay(PGraphics.java:680)
        at processing.core.PApplet.run(PApplet.java:1454)
        at java.lang.Thread.run(Thread.java:662)
BUILD SUCCESSFUL (total time: 4 seconds)


Can anybody help me?






Edit: I've solved the the problem. The image has to be scaled before loading it.
Code:

backgroundImage.width=getWidth();
backgroundImage.height=getHeight();

makes an Error.
You seem to have figured it out - all the image handling stuff in the testbed is done through Processing, so check the docs there at http://processing.org/reference/ for info on the various methods.

Original thread: https://box2d.org/forum/viewtopic.php?t=5885