I'm in a situation where I have a (n+1)x(n+1) texture attached to a framebuffer. My idea is to update this texture in 2 passes.
Draw a full screen quad and use the scissor test to mask out the outermost 1 pixels, so I write to the n x n 'inner' of the texture.
Second pass where I draw line primitives to write to the outermost pixels, and update the same texture, using the result of pass 1 as input. The computation on this step depend on the state of the inner (n x n) grid which was computed in the first pass.
In the second pass I would bind the result of the first pass for both reading and writing. I know that according to OpenGL this would yield undefined behaviour, but since I am never reading and writing simultaneously from the same texels, I think it could work.
Is it a good idea to do it like this, or is it perhaps better to draw a full screen quad, and in my glsl shader do a check like:
if (gl_FragCoord.x == 0.5 || gl_FragCoord.x == n + 0.5){
...
}