Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: gl_FragCoord

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2003
    Posts
    16

    gl_FragCoord

    Hi, what gl_FragCoord means ? I want to port a GLSL shader into Cg code but i don't know how to translate this command. Can anyone help me ?

  2. #2
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: gl_FragCoord

    Straight from the GLSL spec:

    "The variable gl_FragCoord is available as a read-only variable from within fragment shaders and it holds
    the window relative coordinates x, y, z, and 1/w values for the fragment. This value is the result of the
    fixed functionality that interpolates primitives after vertex processing to generate fragments. The z
    component is the depth value that would be used for the fragment’s depth if a shader contained no writes
    to gl_FragDepth. This is useful for invariance if a shader conditionally computes gl_FragDepth but
    otherwise wants the fixed functionality fragment depth."

    The Cg equivalent should be the fragment programs varying input binding semantics "WPOS".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •