I can’t figure out how it works. I am using it to try and save and load a render target, but I just don’t know how this node works. As in: how do I structure the input buffer array?
Having used other rendering APIs in the past, such as SFML, I assumed it was RGBA RGBA RGBA… for as many pixels as there are, but apparently that just gives out an empty image. (invalid object reference)
i dont see an export equivalent for the import buffer as texture 2d
i think you might get more luck using “ExportTexture2D” and " ImportFileAsTexture2D" (both manipulates a file directly and uses a filename).
The problem with using a file is that I would like to have all save data in one single file. I will have a look at the source code, otherwise, I have a slower, alternative method… But it’s quite slow…
Solved. What I am trying to do is save a render target to a save file and load it back in. The render target uses 8 bit RGB (24 bits per pixel) and will always be square. To save, I just use the “Read Render Target” node: it’s slow but it works. I save the output using a SaveGame object.
To load it back in, I created a C++ function which looks as follows:
.h:
(The reason why the V component in the texture coordinate is flipped is due to how bitmaps are saved. Otherwise the image gets flipped.)
I then copy the material to the render target and it’s done!