Render to texture

Hi there!

I'm trying to provide a kind of "observer" in a game, which operates via tcpip.

The observer is defined by a camera. My idea is to render the scene to a texture (like in the example!).

Then I would like to get an image of this texture. I tried to somehow access the rendered data, but the "image"-attribute of the texture is null and I don't know where the texture-information is stored! Anyone an idea how to get a kind of "Image"-Object from a (rendered) texture??

Thanks a lot!


(Because I'm also very interested in this: the idea is to use the rendered texture OUTSIDE of the GL canvas…)

Thx :slight_smile:

I don't know if there is a way to bring a texture from video memory so you can use it. Have a look at OpenGL.

Something that perhaps you could do is :

  1. Set the viewport to the size you want to use for the spectator.
  2. Render the scene from the "spectator".
  3. Take the data from the framebuffer using Renderer.grabScreenContents().
  4. Set the viewport again for the "real" camera.
  5. Render the scene.
  6. Swap buffers.

    I wonder how slow this can be  :evil:


Hmm… Ugly as sin, but worth trying, thanks!

I'll let you know how it goes…

Other idea, anyone?