Unable to get Texture data of a Texture rendered by TextureRenderer

Hello everyone.

I explain a little more : I successfully create my texture and everything goes well. I can render it and it shows what I want. Now I want to access to texture data to make some analysis.

First the standard code for this rendering :

        tRenderer = world.getDisplay().createTextureRenderer(10, 10, TextureRenderer.RENDER_TEXTURE_2D);
        q = new Quad("Quad", 10, 10f);

        fakeTex = new Texture();

        TextureState eye = display.getRenderer().createTextureState();

        tRenderer.render(rootNode, fakeTex);

And now when I try to access to my texture Image :


The Image is [glow=red,2,300]null[/glow], no way to access to
. How can I get this data ? Is it really unreachable ? 


You can't with a TextureRenderer.

You can take a look at the OffscreenRenderer here: http://www.jmonkeyengine.com/wiki/doku.php?id=offscreen_renderer

You'll have access to the image IntBuffer.

FBO support by your graphic card is required though (but I think someone did a pbuffer based version, somewhere on this forum)

Thanks for this answer, I will have a look at your link.

Edit : i’m compiling now, the source needs some updates.

The logging system is no longer used and the source code uses it. 


Doesn't surprise me, this code is more than one year old. But the idea's the same :slight_smile:

Let me know if it works in the end :slight_smile:

(and the wiki will have to be updated too)

Conclusions : 

I made it work. I rendered the offscreenbuffer as a texture for the tests and of course i can access to the data. The topic for the  offscreen renderer with pbuffer is here :


I didn’t noticed siginificant improvements, if I see some later I’ll post it here. Thanks a lot !

You should have better perfs using the FBO version, since using a pbuffer requires a context switch (so you get half the framerate, potentially). That doesn't mean, of course, that the FBO version cannot be improved (in fact it's a first, very naive, attempt)

Still, you can't hope for miracles since you retrieve the image from the graphic card, which is much slower than having the graphic card rendering the image on screen