Easy way to make jmonkey Image or Texture from java.awt.image.BufferedImage?

the way i currently do it is create ByteBuffer, then in a loop, i read each RGB value and set in ByteBuffer, (also, making sure endianess is correct, blah blah), and then finally, create jme.Image from the ByteBuffer.



Very ugly :wink:



Any suggestions to improve?



       ByteBuffer data = ...

        com.jme.image.Image image = new com.jme.image.Image(com.jme.image.Image.RGBA8888, 64,32, data);
        Texture texture  = new Texture();
        texture.setImage(image);




Also, why is there no ARGB image format in JME? Even JDK supports it!  :?

Use any of the TextureManager.loadTexture(java.awt.Image…) or loadImage(java.awt.Image…) methods.  It supports alpha.

I forgot to mention that my textures come are stored in a proprietary format… so i cannot use a Loader directly.

Then it is heavily dependent on what is the API to those images, right?