Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

strange argument exception

Status
Not open for further replies.

beggsy

Programmer
Joined
Oct 25, 2004
Messages
3
Location
AU
My class has compiled completely but during runtime this exception occurs. I have even taken out the input stream tile.jpg out of the program and it still happens. Any ideas?

Thanks


Found: jbeggs.RootProvider
java.lang.IllegalArgumentException: No input stream for: tile.jpg
at dhook.util.ImageUtil.loadImage(ImageUtil.java:35)
at jbeggs.RootProvider.getRootBranch(RootProvider.java:111)
at dhook.util.Main.getRootBranch(Main.java:131)
at dhook.util.Main.buildUniverse(Main.java:230)
at dhook.util.Main.init(Main.java:165)
at com.sun.j3d.utils.applet.MainFrame.run(MainFrame.java:262)
at java.lang.Thread.run(Thread.java:534)
 
Here the code, i have taken out anything to do with tile.jpg but still in runtime it appears. It was using code similiar to earth.jpg lines.

Cheers

public BranchGroup getRootBranch( )
{
BranchGroup objRoot = new BranchGroup();
//plane
QuadArray quadA = new QuadArray(4,
QuadArray.COORDINATES
| QuadArray.NORMALS
| QuadArray.TEXTURE_COORDINATE_2);


quadA.setCoordinate(0, new Point3d(50, 0, -50));
quadA.setCoordinate(1, new Point3d(-50, 0, -50));
quadA.setCoordinate(2, new Point3d(-50, 0, 50));
quadA.setCoordinate(3, new Point3d(50, 0, 50));

quadA.setNormal(0, new Vector3f(0, 1, 0));
quadA.setNormal(1, new Vector3f(0, 1, 0));
quadA.setNormal(2, new Vector3f(0, 1, 0));
quadA.setNormal(3, new Vector3f(0, 1, 0));

quadA.setTextureCoordinate(0, 0, new TexCoord2f(10, 0));
quadA.setTextureCoordinate(0, 1, new TexCoord2f(0, 0));
quadA.setTextureCoordinate(0, 2, new TexCoord2f(0, 10));
quadA.setTextureCoordinate(0, 3, new TexCoord2f(10, 10));

TextureLoader txtLoad = new TextureLoader(ImageUtil.loadImage("grass.jpg", this.getClass().getResourceAsStream("grass.jpg")), parent);

Texture2D t = (Texture2D)txtLoad.getTexture( );

t.setBoundaryModeS( Texture.WRAP );
t.setBoundaryModeT( Texture.WRAP );

t.setMagFilter( Texture.BASE_LEVEL_POINT );
t.setMinFilter( Texture.BASE_LEVEL_POINT );
t.setMipMapMode( Texture.BASE_LEVEL );

// Turn it on and allow future changes
t.setEnable( true );
t.setCapability( Texture.ALLOW_ENABLE_WRITE );

Appearance appear = new Appearance();

Material mat = new Material();

mat.setAmbientColor(0.3f, 0.3f, 0.3f);
mat.setDiffuseColor(0.9f, 0.9f, 0.9f);

appear.setTexture(t);
appear.setMaterial(mat);
Shape3D plane = new Shape3D(quadA);
plane.setAppearance(appear);
return objRoot;

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top