Dynamic texture - setRenderTarget

Started by zbych, February 17, 2012, 09:57:44 PM

Previous topic - Next topic

zbych

I wanted to write an application that uses a dynamically changing textures - just need to copy the contents of one texture to another in the desired location.
I tried to use the opportunity to render to texture, but I found a problem. I do not know whether it is normal for OpenGL ES, but the problem is that during the next call
onDrawFrame the framebuffer holding dynamic texture contains garbage and is useless without clearing and re-rendering it again, but I need to keep the contents of this texture and draw another items on it. I tested it on three devices and only on one of them texture has not been littered between subsequent calls onDrawFrame.

Is any solution to this, or other way to generate dynamic textures without having to load them into GPU memory?

EgonOlsen

Quote...the framebuffer holding dynamic texture...
I don't get it... ???

zbych

Sorry i was thinking about buffer holding texture data not framebuffer

EgonOlsen

I still don't get the problem...you have assigned a render target to a frame buffer. You then render into that texture/render target. And then happens..what?

zbych

I want to render to this texture again, without clearing its data. If I clear it every frame and render to it then everything looks ok, but if I don't clear it (don't call framebuffer.clear() with this texture as render target) then I get dirty texture on input - it is filled with trash and I don't know why.
Of course i clear it when it is first time created, but i don't want to do it every rendered frame.
For example I have rendered letter "A" to this texture and in next animation frame I want to add "B", if I clear this texture then I have to render both letters, but I want to add just new letter - imagine when there are 1000 letters and you want to add 1, if you clear this texture then you have to render 1000 previous letters to add 1 new on the end. I want to avoid it.

EgonOlsen

Try to clear the depth buffer only by using FrameBuffer.clearZBufferOnly();...maybe that helps.

zbych

I have already tried this. Texture looks better but it is not enough.
Thanks for help but it looks like I have to find another way :(


EgonOlsen

Render to texture in OpenGL ES 1.x isn't working too well on some devices. If possible, you might want to try OpenGL ES 2.0 support instead (in case you haven't already...) as it uses FBOs for this, which are more compatible. Maybe that helps.

zbych

It was from begining in GL ES 2.0. I have just tested this on GL ES 1.x and there was black texture, no rendering output .