No API for Loading Images directly

I can’t find any API specific for loading images, but to use TextureArray it is asking for a list of images. AssetManager only contains a way to load a texture. If there is API for loading the images directly this needs to be exposed without needing to load it into a texture first.

  • Thanks

texture.getImage() ? a texture is a really lightweight object, so just ignore it.

Submited as a bug/enhancement request: https://code.google.com/p/jmonkeyengine/issues/detail?id=633

But a texture is just a really thin wrapper around an image. I’m not sure how the AssetManager would know that you want an image instead of a texture.

Behold the horrible example:
[java]
List<Image> imgs = Lists.newArrayList();
imgs.add(findBasePalette(base, “pal_skin01.tga”).getImage());
imgs.add(findBasePalette(base, “pal_hair01.tga”).getImage());
imgs.add(findBasePalette(base, “pal_armor01.tga”).getImage());
imgs.add(findBasePalette(base, “pal_armor02.tga”).getImage());
imgs.add(findBasePalette(base, “pal_cloth01.tga”).getImage());
imgs.add(findBasePalette(base, “pal_cloth01.tga”).getImage());
imgs.add(findBasePalette(base, “pal_leath01.tga”).getImage());
imgs.add(findBasePalette(base, “pal_leath01.tga”).getImage());
imgs.add(findBasePalette(base, “pal_tattoo01.tga”).getImage());
imgs.add(findBasePalette(base, “pal_tattoo01.tga”).getImage());
mat.setTexture(“PaletteArray”, new TextureArray(imgs));
[/java]

(findBasePalette is just calling loadTexture with proper y-flip and wrap mode)

Maybe the real solution is to let TextureArray also take textures. Though it doesn’t really change abies’s code much.

Yah, I use a similar method right now, part of the trouble is dealing with image formats. There are no methods to do image data conversion on images right now, so for instance, if you save a compressed png24 (no alpha) and want to use it with a png32 you can’t as Image has no way of converting BGR to ABGR before uploading to the GPU.

Potentially, I should be able to load the Image in whatever format, and the TextureArray should determine how to send it up to the GPU automatically, we are using computers aren’t we? :stuck_out_tongue:

Hm yes and no, you wont want to do image conversions on runtime.
You would actually want to save your textureatals as the correct dds subformat and just import this.
But I don’t know if the laoader can actually read this yet.