Editing a texture between frames by swapping renderTargets #2474
Unanswered
ancientjpeg
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Any updates regarding this issue? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there!
I'm brand new to r3f, and pretty green on React and JS in general. I'm trying to take an image and distort it every frame with a dedicated distortion fragment shader, and then render the result to the canvas. As reading from and writing to a single shader is generally undefined behavior in Open/WebGL, I'm trying to use the common tactic of reading from one render target, writing to a second, and then swapping them each frame. However, instead of getting the desired effect (slowly mutating the image over time), I'm just getting a rapidly flickering render of my image.
Here's my code:
I apologize in advance for any rookie React mistakes. I come from a C/C++ background, so the very declarative nature of React and r3f is still something I'm getting used to! I'd appreciate any tips/guidance.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions