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 5 of 5

Thread: Problem with gl_FragCoord

  1. #1

    Problem with gl_FragCoord

    If gl_FragCoord is read in the fragment shader, the value of varyings seems not to be correct in all cases. The viewvec varying seems to be calculated from a fixed camera pos. If you replace gl_FragCoord.z in the fragment shader with 0, the view vector is interpolated correct. Btw: The shader doesn't have any special meaning. I've got a Radeon 9800 pro and Catalyst 3.10. Thanks.

    // Vertex Shader
    varying vec3 viewvec;
    varying vec3 texcoord;

    void main()
    {
    texcoord = vec3(gl_MultiTexCoord0);
    viewvec = viewpos - vec3(gl_Vertex);
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    }

    // Fragment Shader
    uniform sampler2D diffusemap;
    varying vec3 viewvec;
    varying vec3 texcoord;

    void main()
    {
    gl_FragColor = vec4(normalize(viewvec)*vec3(texture2D(diffusemap, texcoord.xy)),gl_FragCoord.z);
    }



    [This message has been edited by LarsMiddendorf (edited 01-17-2004).]

  2. #2
    Member Regular Contributor
    Join Date
    Apr 2002
    Location
    Austria
    Posts
    328

    Re: Problem with gl_FragCoord

    *hm* Sounds like a bug in ATI's driver (surely not the only one... ;-)
    Send them a mail at devrel@ati.com
    There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

    There is another theory which states that this has already happened...

  3. #3
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    29

    Re: Problem with gl_FragCoord

    The ATI GLSL implementation in Catalyst 3.10 seems pretty broken to me.

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2004
    Location
    Munich
    Posts
    18

    Re: Problem with gl_FragCoord

    Originally posted by jeremyz:
    The ATI GLSL implementation in Catalyst 3.10 seems pretty broken to me.
    Yep, extremely broken, my experience:

    Matrices are not tracked correctly in some special cases.

    gl_LightSource[n].position is not transformed by the matrix that was on top of the stack, when glLightfv was called

    Use more then 4 texture lookups and the thing goes "woewoe" (SW rendering, but no visible result).

    gl_TexCoord isn't tracked cleanly. You've to set it in the vertex shader using gl_MultiTexCoord<n>

    Materials are not trcked cleanly.
    Wolfgang 'datenwolf' Draxinger

  5. #5
    Member Regular Contributor
    Join Date
    Apr 2002
    Location
    Austria
    Posts
    328

    Re: Problem with gl_FragCoord

    Try ATI Catalyst 4.1!
    Some major bugs have been removed.
    There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

    There is another theory which states that this has already happened...

Posting Permissions

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