I have a program that displays an image to the screen and I want the user to be able to draw on the image how could I do this?
There is a plugin called Image Painter that allows you to paint to textures at runtime pretty much like Swing.
Not sure if it is compatible with the latest version of jme though.
Which is important but only about 30% of the answer.
Your high level steps are as follows:
-detect where the user has clicked on your plane
-determine the position in the texture from the click location
-modify the texture (using something like ImagePainter or more likely just use ImageRaster)
-make sure the texture is updated (I think that’s just one call)
The first two are where most of the work is, I guess. And that can be a pretty deep hole.
Edit: I’ve made quite a few assumptions from your question… such as what you mean by “display an image on the screen”. You may want to provide more detail about what you are doing, what you’ve tried, etc… Else treat my answer very generally.
When I say display an image on screen is I have loaded an image of the letter A on the screen and I want the user to be able to draw on the letter.
How? This tells us no more than it did before. It doesn’t matter what the image is… it does matter how you are displaying it.
Like, is it a quad or picture… or a background image… or painted with swing… something else? We could guess but you already know.
This is how I am displaying the image
…save you a ton of time in the future.
- ultimately you will have to contact the author of the galago library you are using, I guess.
It doesn’t really change the steps I mentioned already. Just the “how” changes slightly.