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

Thread: Adding two GL_DSDT_NV textures

  1. #1
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,107

    Adding two GL_DSDT_NV textures

    To explain what I'm trying to do I'll put a GLSL shader here:
    Code :
    void main(void)
    {
      vec2 offset;
      offset = texture2D( unit0, texcoord[0].xy ).rg;
      offset += texture2D( unit1, texcoord[1].xy ).rg;
      gl_FragColor.a = texture2D( unit2, texcoord[2].xy).a;
      gl_FragColor.rgb = texture2D( unit3, texcoord[3].xy + offset).rgb;
    }
    I'm trying to implement above shader using NV_texture_shader.
    I put DSDT_NV textures into unit #0 and #1, and the RGBA texture into units #2 and #3 (the same texture - I'm reading it twice).

    Here is my configuration:
    unit / format / shader / env
    #0 / DSDT_NV / TEXTURE_2D / GL_REPLACE
    #1 / DSDT_NV / TEXTURE_2D / GL_ADD
    #2 / RGBA / TEXTURE_2D / GL_REPLACE
    #3 / RGBA / OFFSET_TEXTURE_2D_NV / GL_COMBINE_ARB

    Combine at unit #3:
    RGB = REAPLACE / TEXTURE / SRC_COLOR
    ALPHA = REPLACE / PREVIOUS / SRC_ALPHA

    The problem is that if I use unit #0 as input for OFFSET_TEXTURE_2D_NV then I get what I expect - final image distorted by texture #0, but when I use unit #1 as input then I get my image distorted by unit #1 only. I want it to be distorted by sum of units #0 and #1.

  2. #2
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,107

    Re: Adding two GL_DSDT_NV textures

    Anyone?
    I've just finished implementing the above using ATI_fragment_shader. It would be great if I could finish the NV_texture_shader version now.

  3. #3
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,107

    Re: Adding two GL_DSDT_NV textures

    I've changed my code to use dependent-gb reads, but the problem remains. I'll leave it at that.

Posting Permissions

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