Hai!
I got this function that loads images.
The problem is that, nomather what I do, it refuse to load my other picture:
tree.jpg
I dont know whats wrong with it, it says:
2010-jan-06 21:33:03 com.jme.util.resource.ResourceLocatorTool locateResource
VARNING: Unable to locate: tree.jpg
java.lang.NullPointerException
at hello3d.test.ModelnTexture.getModel(ModelnTexture.java:69)
line 69 is this:
textureR = new URL(ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_TEXTURE, tex).toURI().toString());
and heres the whole code:
URL textureR;
try {
ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, new SimpleResourceLocator(HelloWorld.class.getResource("/data/textures/").toURI()));
textureR = new URL(ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_TEXTURE, tex).toURI().toString());
System.out.println(textureR);
texture.setTexture(TextureManager.loadTexture(textureR,Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear,1.0f,true));
texture.setEnabled(true);
texture.setTextureCoordinateOffset(0);
//System.out.println(textureR);
node.setRenderState(texture);
node.updateRenderState();
node.setModelBound(new BoundingBox());
node.updateModelBound();
//node.setRenderState(materialState3);
} catch (Exception ex) {
ex.printStackTrace();
}
the pictures I load is "ammoBoxTex.jpg" , "tree.jpg" (this one doesnt work) , "ground.jpg"
I load all the exact same way, got em all in exact same directory still it doesnt work!
Please help, I'v been debugging for hours but havn't got a clue why it doesnt work :'(