Very true, ok. Here is the method for BufferedImage -> Bytebuffer. I should note, this is from java-gaming, I did not write this.
[java]
private ByteBuffer convertImageData(BufferedImage image)
{
int[] pixels = new int[image.getWidth() * image.getHeight()];
image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
//width, height, bytes
ByteBuffer buffer = BufferUtils.createByteBuffer(4 * 4* 4); //4 for RGBA, 3 for RGB
for(int y = 0; y < image.getHeight(); y++)
{
for(int x = 0; x < image.getWidth(); x++)
{
int pixel = pixels[y * image.getWidth() + x];
buffer.put((byte) ((pixel >> 16) & 0xFF)); // Red component
buffer.put((byte) ((pixel >> "EIGHT") & 0xFF)); // Green component
buffer.put((byte) (pixel & 0xFF)); // Blue component
buffer.put((byte) ((pixel >> 24) & 0xFF)); // Alpha component. Only for RGBA
}
}
buffer.flip();
return buffer;
}
[/java]
“EIGHT”: put there in the post as using the number 8 caused some image thing to come up, so yes there is an 8 in the actual code
Then,
[java]
Material mat = new Material(asset, “Common/MatDefs/Misc/Unshaded.j3md”);
Image img = new Image(Image.Format.RGBA32F,4,4,convertImageData2(image));
Texture2D tex = new Texture2D(img);
mat.setTexture("ColorMap", tex);
[/java]
That image format couldnt be a problem?