Hello. I am having trouble with making a basic textured cube.
I get the error:
SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Material parameter is not defined: Texture0-4-0
Here is a snippet of my src code:
[java]
if (y > 3) {
Box b = new Box(new Vector3f((float) x, (float) y, (float) z), cubeSize, cubeSize, cubeSize);
Geometry geom = new Geometry("Cube" + x + "-" + y + "-" + z, b);
Material mat = new Material(assetManager, "Common/MatDefs/Misc/SimpleTextured.j3md");
Texture texture = assetManager.loadTexture("images/water.png");
mat.setTexture("Texture" + x + "-" + y + "-" + z, texture);
geom.setMaterial(mat);
rootNode.attachChild(geom);
}
[/java]
Does anyone know what I am doing wrong?
thanks that worked. I really wish they would update the javadocs, ‘name’ implies that it’s the name for the material.
nehon said:
You are trying to attach the texture to a "Texture0-4-0" parameter, that does not exists in the material definition, thus the error.
What are you trying to do exactly with this?
`
"Texture" + x + "-" + y + "-" + z
`