I am attempting to create a display for a bunch of meteorological data. The data is read from a web server and I want to use graphs to display it. I have JFreeChart working to create graphs, and it is dumping renders of the data to .png files. I am currently loading the .png into a material and displaying it on a quad; which is working quite well. The issue I have is that my separate java application will read and update the image files every time new data appears, and I cannot figure out how to make Jmonkey reload an asset. the “assetManager” is designed to prevent you from loading to same asset twice, but how can I get around this?
This was my attempt as loading an image directly:
File f = new File(“assets\Scenes\GraphTest\saved3.png”);
Texture t = assetManager.loadTexture(“Scenes/GraphTest/saved3.png”);
Image I = new Image();
try{
I.read(BinaryImporter.getInstance()); //This Line Doesnot work.
System.out.println(“Worked”); // quick debug
}catch(Exception e){
System.out.println(“Read Error”); // quick debut
}
t.setImage(I);
Material m = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);
m.setTexture(“DiffuseMap”, t);
rootNode.getChild(“Graph”).setMaterial(m);
The file is addressed correctly I am just not sure how to load it into a JME style Image? Should I be using Image.setData() ? or is there a completely different way to go about this?