Results 1 to 5 of 5

Thread: what is FramebufferTexture1D for ?

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2009
    Location
    Seoul, Korea
    Posts
    4

    what is FramebufferTexture1D for ?

    I'm very curious about what we can do with FramebufferTexture1D(). I searched for any information and usage of this function in this forum and google, it was fruitless.

    Does it mean we can render to 1D texture apart from 2D, 3D, 2D array and cube ?
    But I can hardly imagine that fragment shader can write to 1D texture.
    What do you think the common usage of FramebufferTexture1D is ?
    I presume something like "render-to-texture-buffer" may be possible via this function, but I have no confidence on it.

  2. #2
    Senior Member Regular Contributor Heiko's Avatar
    Join Date
    Aug 2008
    Location
    the Netherlands
    Posts
    170

    Re: what is FramebufferTexture1D for ?

    Yes, you can render to a 1D texture. Often 1D textures are used as lookup textures. Rendering to the 1D (lookup) texture is a way to fill your lookup table.

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2009
    Location
    Seoul, Korea
    Posts
    4

    Re: what is FramebufferTexture1D for ?

    Thanks for your reply, Heiko.
    Frankly, I have problem in understanding the rasterization of 3D object to 1D render-target. I doubt it's of any use.

    What I'm wondering is, if we render two fragments having the same y coordinate in NDC to 1D texture, then does one of them overwrite the other one ?
    I.e, in NDC, the two fragments (-1,0) and (-1,1) both are written to the left-most pixel of 1D texture ?

  4. #4
    Senior Member Regular Contributor Heiko's Avatar
    Join Date
    Aug 2008
    Location
    the Netherlands
    Posts
    170

    Re: what is FramebufferTexture1D for ?

    There is probably not much use of rendering 3d objects to a 1D texture. But if you really want to, you could render objects to a 1D texture, using a viewport that has a very small height (of 1 pixel).

    In the example you give, one of the fragments would fall outside the viewport and won't be rendered at all. So: no, only one of them is written to the left-most pixel.

    Probably more useful is to render a 1 by n quad to a 1D texture and perform some calculations in the fragment shader to put useful values in the 1D texture. In another render pass you can use the 1D texture as a lookup table.

  5. #5
    Junior Member Newbie
    Join Date
    Sep 2009
    Location
    Seoul, Korea
    Posts
    4

    Re: what is FramebufferTexture1D for ?

    Adjusting viewport seems to be a good option for FramebufferTexture1D. Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean