[SOLVED]guiNode(No Nifty) how to get repeat texture Picture

hi,



i want to create a texture and draw it as Picture in guiNode. I tried:



[java]

Texture2D tex = new Texture2D(image1);

tex.setWrap(Texture.WrapMode.Repeat);

picture.setTexture(assetManager, tex2, true);

[/java]



but this texture is resized, not repeat. I know how to do this for a Box/etc but i don’t know how to do it for a Picture in guiNode.



Any advice?



And BTW: next question, how to create Picture as transparent color. Is there a way to create bufferedImage and save it to the picture?

You have to scale the texture coordinates of the quad mesh, e.g.:

[java]

picture.getMesh().scaleTextureCoordinates(new Vector2f(0.5f,0.5f));

[/java]

2 Likes

thank you very much :slight_smile:



and any advice for a second question?

Like with any other geometry:

picture.getMaterial().getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

2 Likes

i see, gui hud is a geometry with texture. I had never think in this way :slight_smile: I rather thinked it override rendered pixels :slight_smile:



so if i good understand i can set material(like on other geometries - becouse gui = geometry) on it with color and use blendMode





in better case i can just create a geometry rectangle near camera(distance 0?) and set material with blendMode :smiley:

“Picture” is just a geometry with a quad mesh and a textured material, yeah.

picture is still missing, getWidth() and getHeight() :roll:

I had maked my own class of Picture, you can do the same. So what’s the problem? it is alpha still :stuck_out_tongue: :slight_smile:



btw: we should help jme developers :slight_smile: it’s good for everyone. Im too weak to help for now.