   GLSL: previous fragment check
  Is there a way to check the previous value in the gl_FragColor?  Basically I only want to set a new value for gl_FragColor if there is a previous pixel in that screen coordinate.  How do I check for that?   
  No, you can't; the fragment/pixel program can't read from the frame buffer.   ;Quote:Original post by phantomNo, you can't; the fragment/pixel program can't read from the frame buffer.Which is becoming more and more of a problem, actually. Not being able to read from the framebuffer (or the currently bound FBO) without relying on undefined behaviour is a major annoyance. A fully programmable blending stage is long overdue, if you ask me.;  AGREED!  hah  eventhough I'm just getting into programmable pipelines, i'm seeing a drawback with that in a particular effect I'm going for: X-Ray vision   ;Quote:Original post by Yann LWhich is becoming more and more of a problem, actually. Not being able to read from the framebuffer (or the currently bound FBO) without relying on undefined behaviour is a major annoyance. A fully programmable blending stage is long overdue, if you ask me.I agree. It was originally proposed by 3DLabs years ago and left out because "of complexity". Now that uberbuffers are there, there's no reason to not allow reading.As a side note, I hate blending as it works now.   ;  I agree about a programmable blending stage, but can't the original poster do what he wants using the stencil buffer?   ;  how could I do that in the stencil buffer?  could you give an example please?  (i'm not too familiar with the stencil buffer at this point)   