How can I load an generated texture?

Hello jMonkeyEngine Community,

How can I load an generated texture?

The same way as any other texture.

If you mean generated on runtime, look into AWTLoader.load - it will convert buffered image into jme3 Image, from which you can construct texture. If you are not using Graphics2D but directly playing with bytes, then just create ByteBuffer and pass it to jme3 image, just be sure that format is right (I have major problems with getting integers fit jme3 image formats - end up doing trial and error).

Thank you for your answers!
The texture is not in the assetpack, it is in an other extern folder.
It will be generated on runtime, but it is also saved as file in this extern folder and must be loaded at the start of the server.
I have used the FileLocator class, but it doesnt work.
How can i load an buffered image?

@JuKu said: I have used the FileLocator class, but it doesnt work.

Well, that would be somewhere to start I guess. Unfortunately, we can’t see any of your code from here which makes it impossible to help figure out why that didn’t work.

The texture is an heighmap which ich located in GameData/gameworld/gameworld1/Textures/Terrain/splat/heightmap.png.
[java]

assetManager.registerLocator("./", FileLocator.class);

//Load Texture
Texture texture = new Texture(assetManager, “GamaData/gameworld/gameworld1/Textures/Terrain/splat/heightmap.png”);

[/java]

This code doesnt work.

I suppose you get a null pointer returned? Then the file probably isn’t at ./GamaData/gameworld/gameworld1/Textures/Terrain/splat/heightmap.png

The code throws this exception:
[java]Jul 14, 2014 3:11:52 PM de.gamebasislib.gamelogger.GameLogger log
Warnung: AssetNotFoundException: GameData/gameworld/gameworld1/assets/Textures/Terrain/splat/heightmap.png (Flipped) (Mipmapped)[/java]

The original code is this:
[java]
this.app.getAssetManager().registerLocator("./" + gamesettings.getGameSetting(“de.gamebasis.gameworld.filePath”) + “/”, FileLocator.class);

//Load texture
Texture heightMapImage = this.app.getAssetManager().loadTexture(gamesettings.getGameSetting(“de.gamebasis.gameworld.filePath”) + “/” + rs.getString(“heightmap”));
[/java]

The texture file exists.

Thank you for your answer!
The code works!

The correct code is this:
[java]
this.app.getAssetManager().registerLocator("./" + gamesettings.getGameSetting(“de.gamebasis.gameworld.filePath”) + “/”, FileLocator.class);

//Load texture
Texture heightMapImage = this.app.getAssetManager().loadTexture(rs.getString(“heightmap”));
[/java]