I have some custom graphics that are created dynamically at run time with buffered images. I used the awtloader to load them into a texture.image file
AWTLoader imgLoader = new AWTLoader();
Image load = imgLoader.load(off_Image, true)
I’m stuck at this point. When you create a new JME picture it ask to load the image from a file. However I have the image stored in memory. What would be the best way of converting this over to a JME Picture. I need a Picture type not a texture type. I want to load the image into the guiNode. Thanks for any help.
Then take the image and put it into a texture if you want it in a texture.
Completely ignore Picture. It’s a totally useless class that only hides the stuff you actually need to know and exposes everything else you don’t. Just create a quad and put the texture on it.
I’m using an array of the Picture class to store images. However I have a few images that need to be drawn at run time using custom graphics. I can’t get the image to show in the Picture.
BufferedImage off_Image = new BufferedImage(500, 500, BufferedImage.TYPE_INT_ARGB);
Nothing is rendered. Basically I’m trying to get the image that was drawn into the Picture object. Everything I have is currently based off Picture so I need to either figure this out or rewrite my entire code. I’d rather figure this out.
Geometry test = new Geometry("myPic", new Quad(500, 500));
Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.setTexture("ColorMap", new Texture2D(load));
test.setMaterial(mat);
test.setLocalTranslation(50, 50, 0);
guiNode.attachChild(test);
Ok, I’m not sure how we can debug code we can’t see when we are presented an entirely different kind of buggy code. Seems kind of like a waste of time.
If it were up to me it would be removed completely… but that would probably break quite a few folks.
I do think tutorials shouldn’t use it. As I said, it hides the parts a user should know and exposes a bunch of useless crap that hides what it’s really doing. Personally, I think the Geometry approach is simpler, less code, and teaches you something you can use again and again.