Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Nuno Donato | |
Old Version | Published before Godot 3 was released. |
Hi folks!
So my situation is this: I’m generating icons to represent certain objects when the inventory shows up. I need to do the icons in-game instead of static files, because they change based on a number of parameters.
I’m basically using a viewport scene to load the object and then get the viewport texture, so that I have the object I need.
I can use this nicely anywhere, but later I will need to save the game and it would be great to save these icons too instead of re-generating everything when loading the game. So now the problem comes, how the hell can I save a texture to an image?
It seems easy to create a texture from an image, but not the reverse. Am I missing anything?
As a last resort I can forget the ViewportTexture and just do a screenshot from that viewport, but …
thanks
A capture like this?
How to merge two png files during runtime and save to disk ? - Archive - Godot Forum
But yes the screen capture sounds weird, you can get the image from TextureImage, not sure about the RenderTargetTexture.
ViewportTexture is a Godot 3 resource, are you talking about 3? (could be nice to have that option on this new resource, btw).
eons | 2017-04-11 22:38
oh yeah sorry, I’m in 3. I can’t find a way to get the image from a texture. I can get it from TextureImage but I can’t build a TextureImage from another texture so…
Nuno Donato | 2017-04-12 08:03