Material parameter is not defined Error (Solved)

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?

yep the SimpleTextured material needs the texture to be set as the “m_ColorMap” parameter.

this is mapped as a uniform in the shader in order to render the material correctly.



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

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
`

Yeah, I thought it was a name variable.
dreigon said:
I really wish they would update the javadocs, 'name' implies that it's the name for the material.

You're right. I did, check the latest SVN