Texture.createSimpleClone() copies everything concerning the Texture except the image itself, but I need that too.
What I am doing is I have a TextureRenderer that renders an animated model to a Texture, kind of like ImposterNode is doing it. This is already working. I need a Texture that shows the animation of the model at time 0.0f.
After the TextureRenderer is set up I want to somehow retrieve a copy of the Texture:
does not work because the texturerenderer will keep rendering to the cloned Texture. I want it to write the texture once and then somehow detach it from the renderer.
Not sure if this would work, but seeing as it’s just a normal Java object like everything else I imagine it would. I created a cloning utility in jCommon that provides several methods of deep cloning:
It defaults to use the reflection method (which is by far the fastest), but you can always configure it to use a more typical deep cloning style if you prefer.
Deep cloning wont do the job, since the textureId is what identifies the texture to OGL, and using the same textureId will result in overwriting the texture.
Set up two textures for RTT, after you render to the first texture, use that as your original clone, after that use the second to render to afterwards.
and in the draw() method, i render the animatedTexture.
this is somehow worse than copying the initial texture since it is being drawn twice, but it is only done once in the constructor which is called at the startup of the game. :)
Set up two textures for RTT, after you render to the first texture, use that as your original clone, after that use the second to render to afterwards.