Illegal Image Size

Hi, having returned to basic J3D bits and bobs for a few years now and I'm having some issues loading a texture.

After having read through a few tutorials I have put together the following code. It simply creates a QuadArray of 4 points, sets the texture coordinates (which I don't know if I have done correct i.e., please note the first parameter, as the method I used to use is deprecated now) then apples and image of 64x64 pixels, a multiple of 2 - which i believe is required by J3D.

private Shape3D loadTexture(){

QuadArray plane =new QuadArray(4,GeometryArray.COORDINATES|GeometryArray.TEXTURE_COORDINATE_2);

Point3f p =new Point3f();

p.set(-1.0f,1.0f,0.0f);

plane.setCoordinate(0,p);

p.set(-1.0f,-1.0f,0.0f);

plane.setCoordinate(1,p);

p.set(1.0f,-1.0f,0.0f);

plane.setCoordinate(2,p);

p.set(1.0f,1.0f,0.0f);

plane.setCoordinate(3,p);

TexCoord2f q =new TexCoord2f();

q.set(0.0f,1.0f);

plane.setTextureCoordinate(0,0,q);

q.set(0.0f,0.0f);

plane.setTextureCoordinate(0,1,q);

q.set(1.0f,0.0f);

plane.setTextureCoordinate(0,2,q);

q.set(1.0f,1.0f);

plane.setTextureCoordinate(0,3,q);

URL textureURL = getClass().getResource(TEXTURE_LOCATION);

TextureLoader loader =new TextureLoader(textureURL,this);

ImageComponent2D image = loader.getImage();

Texture2D texture =new Texture2D();

texture.setImage(0,image);

Appearance appearance =new Appearance();

appearance.setTexture(texture);

Shape3D shape =new Shape3D(plane,appearance);

return shape;

}

Any help working out why I am getting the following exception would be greatly appreciated:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Texture:illegal image size

at javax.media.j3d.TextureRetained.checkImageSize(TextureRetained.java:392)

at javax.media.j3d.TextureRetained.initImage(TextureRetained.java:337)

at javax.media.j3d.Texture.setImage(Texture.java:960)

Thanks

[2467 byte] By [necro_ignisa] at [2007-11-27 7:43:19]
# 1
It is most likely that the image you are using is incompatible. The dimensions of your image must be a base of 2. Ie, 16, 32,64,128,etc You need to resize your image so that it fits these requirements.
Vassimia at 2007-7-12 19:24:07 > top of Java-index,Security,Cryptography...