Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualsamoth

Posted 17 May 2013 - 02:42 PM

That won't work. You have only 3 legitimate options:

  • disable depth writes (using the GL API, not in GLSL) -- this will not write depth for any pixel
  • don't write to gl_FragDepth in your shader (not at all) -- this will use the interpolated depth instead
  • discard -- this will kill the fragment, including depth (but also color)

 

Writing to gl_FragDepth for some fragments and not doing it for some others is theoretically possible, but a shader doing so is not well-formed. The outcome is undefined.

 

To throw away pixels that you don't want, I'd just discard, that's what it's for. It discards the color value, nothing is written out.


#2samoth

Posted 17 May 2013 - 02:41 PM

You have only 3 legitimate options:

  • disable depth writes (using the GL API, not in GLSL) -- this will not write depth for any pixel
  • don't write to gl_FragDepth in your shader (not at all) -- this will use the interpolated depth instead
  • discard -- this will kill the fragment, including depth (but also color)

 

Writing to gl_FragDepth for some fragments and not doing it for some others is theoretically possible, but a shader doing so is not well-formed. The outcome is undefined.

 

To throw away pixels that you don't want, I'd just discard, that's what it's for. It discards the color value, nothing is written out.


#1samoth

Posted 17 May 2013 - 02:39 PM

You have only 3 legitimate options:

  • disable depth writes (using the GL API, not in GLSL) -- this will not write depth for any pixel
  • don't write to gl_FragDepth in your shader (not at all) -- this will use the interpolated depth instead
  • discard -- this will kill the fragment, including depth (but also color)

 

Writing to gl_FragDepth for some fragments and not doing it for some others is theoretically possible, but a shader doing so is not well-formed. The outcome is undefined.


PARTNERS