Render to image

I am trying to export the scene into a set of images using the TextureRenderer class. The problem is that I am unable to retrieve the image data out of the texture. The texture does have its own getImage method which in turn has a getData method. By using that data i might have been able to create a BufferedImage and saved it to disk. The problem here is that the texture does not have a image-object bound to itself. Using the setStoreTexture method on the texture does not help either.

Textures rendered via TextureRenderer are card side only, so getImage() will give you nothing.  setStoreTexture() is non-related to this issue.

I am trying to export the scene into a set of images using the TextureRenderer class.


Why not just use renderer.takeScreenShot(String filename) ?
basixs said:

I am trying to export the scene into a set of images using the TextureRenderer class.


Why not just use renderer.takeScreenShot(String filename) ?


As I said, I am trying to create a series of images from the created scene. From what I can see, using the takeScreenShot is the only method for saving an image created from the scene. The reason why I wanted to use the TextureRenderer, was that I don't want to hijack the camera from the original scene for creating the images. As far as I can see, that might be the only solution available.

The overall goal of this operation is to create a set of images that will eventually be used as the basis of a minimap in the main game. We have a tool where we create the game world, and want to integrate the process of creating these minimap images into this tool. The reason why we want images instead of a miniature renderer of the game world, is that we want to increase performance, and not having all movable props drawn inside this given minimap.

You can have a look at the OffScreenRenderer class (and its implementation, LWJGLOffscreenRendererClass) on the wiki.

It uses FBOs so your card must support them. If not, I think I just saw a fallback class which uses pbuffers on this forum, a couple of days ago.


Using the offscreen renderer worked perfectly. Thanks for the help.

:slight_smile:

Glad I could help :slight_smile:



(be advised though, there are some serious limitations at the moment, i.e. you cannot use render passes with this renderer)