Material parameter is not defined :(

I have been over my code many times and I am struggling to see what is wrong with this:

[java]for(int i = 0; i < 6; i++){

faces = new Quad(width, height);

faceMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");

faceMat.setTexture("texture", tex);

faceGeom = new Geometry("geom", faces);

faceGeom.setMaterial(faceMat);

}[/java]

The error I get is:

[java]SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.IllegalArgumentException: Material parameter is not defined: texture[/java]



The tex is a grass texture from an array I pass into the method. I even tried setting a colour instead of setting the texture but I get the same error except with the setColor() line of code.

Thanks to anyone who can help :slight_smile:

I managed to get it kind of working - it has something to do with trying to store the material in the array…

There is no parameter named texture. take a look at the j3md file to see the possible parameters

Yeah, there’s no parameter called texture, there’s the “ColorMap” param. Don’t be afraid to read the articles from this awesome forum ;). Take a look at this : https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:material_definitions#using_a_material.

Ah stupid mistake - Thanks guys :slight_smile: