I’ve got my FBO ping pong up and running. But I’m having an issue on the GLSL side. I have a setup where I’m doing two passes with different shaders in my render loop. The first pass with my “process” shader writes to my FBO and creates a texture. The second, rendering, pass uses the texture created from the first pass to generate colors (it does not actually render the texture).
I know this set up works, because in my “process” shader, I can set gl_FragData to a color, and in my “render” shader, I can render that color.
My problem is more with coordinates. In my “process” shader, I need to look at neighboring pixels in the texture and update gl_FragData based on their values. In my “render” shader, I need to do the same thing to create a color based on shading/refraction.
I’m passing in the screen width and height to both, and am successfully retrieving those values, so I have that to work with. However, I just can’t get my texture coordinates lined up to save my life.
Is there any way I can use the screen width and height variables I have in my shaders to get everything into screen space? How do I get the color of neighboring pixels in my texture?
Thanks in advance.