Results 1 to 4 of 4

Thread: GLSL shaders - keeping a value per fragment iteration

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2007
    Posts
    49
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    4
    Thanked 6 Times in 5 Posts

    Default Re: GLSL shaders - keeping a value per fragment iteration

    Quote Originally Posted by high_flyer View Post
    I need to implement a demosaic/debayer algorithm in a fragment shader.
    The bayer masked image is given as a texture to the shader.
    I have the need to know if my current fragment position is on an odd or
    even position.
    You can use predefined even/odd texture same dimensions like masked image, where values for the texels would be, example, 0 for even, 1 for odd.

    If it is, is there a way to have a value stored from one fragment
    iteration to the next?
    Render to texture(s), aka FBO.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: GLSL shaders - keeping a value per fragment iteration

    You can use predefined even/odd texture same dimensions like masked image, where values for the texels would be, example, 0 for even, 1 for odd.
    Thanks for answering.
    Yes, I thought of that, but I really would like to stay with one texture.
    I tryied using calculation with floats, and it looks like it does work.
    I thought that there is going to be an accumulated floating resolution error, but it looks that there is none.
    Render to texture(s), aka FBO.
    True, I could just use one pixel texture. thanks, I don't need it any more, but thanks never the less for the idea, might come handy some day :-)
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Feb 2007
    Posts
    49
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    4
    Thanked 6 Times in 5 Posts

    Default Re: GLSL shaders - keeping a value per fragment iteration

    Thanks for answering.
    Yes, I thought of that, but I really would like to stay with one texture.
    I tryied using calculation with floats, and it looks like it does work.
    I thought that there is going to be an accumulated floating resolution error, but it looks that there is none.
    Another variant of my idea. The even/odd texture could be small, 2x2 size. GL_REPEAT will do the rest...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.