What do I need to do to create a png compatible with ColoredTextured.j3md?

I’m trying to use ColoredTextured.j3md but so far the only image I can make work is the supplied Textures/ColoredTex/Monkey.png

even if I open this image and resave it (I’m using the gimp), it fails with:

java.lang.IllegalArgumentException: The given texture parameter is not set. m_ColorMap

at com.jme3.material.Material.clearTextureParam(Material.java:352)



so my question is, what is/isnt required as part of the png to make this work?



Cheers

Jase

Any png should work.

This error occur when you set a null parameter to a material.

I guess you have mat.setTexture(“m_ColorMap”, texture);

texture must be null, meaning the asset manager didn’t manage to load it.



Check the path to your texture, and check the text case because it matters.

Also check the console as there might be erros mentiond

I noted the error I get above.

I can use some images but not others, even if they are in the same folder and with the same name.

I’m doing this:



[java]Material mat = new Material(app.getAssetManager(), “Common/MatDefs/Misc/ColoredTextured.j3md”);

// mat.setTexture(“m_ColorMap”, app.getAssetManager().loadTexture(“Textures/ColoredTex/Monkey.png”));

mat.setTexture(“m_ColorMap”, app.getAssetManager().loadTexture(“coloured.png”));

mat.setColor(“m_Color”, ColorRGBA.randomColor());

bot.setMaterial(mat);

[/java]



I think there is something very odd happening with the loader because for the case where an image wont load and throws an exception,

if I uncomment the commented line above so that it loads the monkey image first, and then tries to load my coloured.png then I no longer get any exception. However, it loads a different image altogether as the texture (ie not Monkey.png, and not coloured.png). Its possible that its the previous successfully loaded image that’s used, but it definitely isnt one of these 2.

I even tried re-saving the image from windows paint, but same result.



I’d post the offending image but not sure where to put it.

Cheers

where is your coloured.png texture in you project?

nehon said:
where is your coloured.png texture in you project?


its in a local folder names assets/textures

In it I also have a number of other images which I can load without issue.
If I preface the name of the png with the path however it doesnt work. ie "assets/textures/myimages.png" never works so I've just gone with what does.

I guess you are adding each folder you want to load an image from to the assetManager root and then end up with lots of images with the same name being “myimage.png”.

normen said:
I guess you are adding each folder you want to load an image from to the assetManager root and then end up with lots of images with the same name being "myimage.png".


actually no. there is a single folder in my project called assets/textures.
this is in addition to the folders that are included in the jme3 distro.
it has just 5 images in it, all named differently obviously. the image it actually loads in the case above is called tokyo17a.png and its in the same folder.