I am working with “render to texture” feature using FBOs and textures attached.
My problem is that in the fragment shader i don’t know how to write to an specific row of the 2D-texture. I do have the information of which row (indicated by a uniform float variable), but i dont know how to draw just there.
Is this possible? Or what is a good way to know where am i in the fragment shader?
My global idea is to render the evolution of a 1D-texture into a 2D-texture from top to bottom. Each evolution step is computed by a fragment shader (usiong render to texture ping-pong method, with 2 FBOs)
You can use
discard;in the fragment shader to throw away fragments you don’t want. Something likeThen render your scene normally, and you’ll end up with just one row of the output written.