I have generated an Alpha Texture for My terrain, but it is currenlty a Buffered Image, however my terrain requires it to be of the type: Texture, how can i convert a BufferedImage to a Texture?
Thank you
I have generated an Alpha Texture for My terrain, but it is currenlty a Buffered Image, however my terrain requires it to be of the type: Texture, how can i convert a BufferedImage to a Texture?
Thank you
You can instantiate an AWTLoader and use it to convert:
http://hub.jmonkeyengine.org/javadoc/com/jme3/texture/plugins/AWTLoader.html#load(java.awt.image.BufferedImage,%20boolean)
…but I wonder if it wouldn’t be better to just draw directly to a JME image. See: ImageRaster and/or the ImagePainter plugin.
I have an image, but i want to convert it into a texture.
Image alpha = alphaGen.renderAlphaMap();
BufferedImage alphaBImg = ImageToAwt.convert(alpha, false, true, 0);
Texture alpha = //What to put here?
mat_terrain.setTexture("Alpha", alpha);
@TastyLemons said: I have an image, but i want to convert it into a texture.Image alpha = alphaGen.renderAlphaMap();
BufferedImage alphaBImg = ImageToAwt.convert(alpha, false, true, 0); Texture alpha = //What to put here? mat_terrain.setTexture("Alpha", alpha);</blockquote>
Wait… if you already have an image then why convert it to a BufferedImage?