View Full Version : What kind of values should gl_FragDepth be giving?
05-24-2007, 11:10 AM
I would think this would return a float between 0 and 1, but it seems to always return 0. All I am trying to do is get the fragment depth for fog rendering.
05-24-2007, 12:39 PM
The gl_FragDepth is output variable which is used to override depth of the fragment. The fragment depth calculated by hw is stored within gl_FragCoord.z
05-24-2007, 12:42 PM
I thought ATI didn't support gl_FragCoord.z.
05-24-2007, 01:07 PM
Originally posted by Leadwerks:
I thought ATI didn't support gl_FragCoord.z. It does not have explicit hw support however the driver tries to emulate it using ordinary varying. It is possible that use of additional feature such as polygon offset (
see here (http://www.opengl.org/discussion_boards/ubb/ultimatebb.php?ubb=get_topic;f=11;t=001243#000000) ) will force it to sw emulation or that some drivers have buggy implementation.
If you do not wish to rely on the driver, you can calculate the depth in vertex shader and send it trough the varying manually.
05-24-2007, 02:22 PM
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.