Tint a texture


I have an object mapped with their texture, i want to tint the texture by one colour.

i am using:

tex.setBlendColor(new ColorRGBA(1.0f, 0.0f, 0.0f, 1.0f));


In this case i want to tint my object by red, but nothing does.

How can i acomplish that?


In one of the jME tutorials by Jack Lindamood material states are used to achieve a color tint. (http://www.jmonkeyengine.com/wiki/doku.php?id=starter:hello_states)

MaterialState msRedTint = display.getRenderer().createMaterialState();
msRedTint.setEmissive(new ColorRGBA(1.0f,0.0f,0.0f,1.0f));


So you just have to apply this Material State additionally to your object to tint it.

I tryed your solution, works fine when lighting is enabled, i am working without lights and doen't work in that situation.

In that case, have you tried vertex colors?

yes, using setSolidColor(ColorRGBA.red) into the mesh does not take effect when it is textured.

Well, vertex colors should tint textures as long as you are not using lighting.  See TestBoxColor for example.  If you are using lighting, either tint with a material diffuse color, or use the colormaterial property of a material state to pull colors from vertices.