Hi
Im rendering to a fbo texture and i want to use that texture in the next frame while also rendering to the same texture.
So I probably need a copy of that fbo texture. What is the best way to do this? If possible without copying to the cpu.
thx
Hi
Im rendering to a fbo texture and i want to use that texture in the next frame while also rendering to the same texture.
So I probably need a copy of that fbo texture. What is the best way to do this? If possible without copying to the cpu.
thx
Why don’t you use another texture to write to? This will avoid an extra memory copy. In a ping-pong setup:
pass 1:
read from tex 1
write to tex 2
use tex2 for rendering
pass 2:
read from tex2
write to tex1
use tex1 for rendering
pass 3:
read from tex 1
write to tex 2
use tex2 for rendering
If you still want to go about it your way, I suggest using glCopyTexSubImage or FBO blitting.
I initially thought that it just wasnt possible to read and write to the same fbo, because i apparently made some mistakes. But it is only not possible to read and write to the same fbo texture. I fixed my code and the ping-pong setup works now.
Thanks very much
Actually, it is possible to read and write to the same fbo texture, but the results will be undefined