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

Thread: shader: same texture as source and destination

  1. #1

    shader: same texture as source and destination

    I need to implement a kind of accumulation buffer,
    which means reading from the buffer, perform some
    shader ops on it, and write the data back to the
    same buffer. Is it possible to set this up without
    having to make a separate copy of the buffer?
    TIA!

    .rex

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: shader: same texture as source and destination

    Nope, only if your operations can be done through blending.

    Otherwise use ping-pong RTT.

    Jan.
    GLIM - Immediate Mode Emulation for GL3

  3. #3

    Re: shader: same texture as source and destination

    Thanks Jan!

  4. #4
    Member Regular Contributor Jackis's Avatar
    Join Date
    Sep 2005
    Location
    Saint-Petersburg, Russia
    Posts
    275

    Re: shader: same texture as source and destination

    By the way, rexguo, if you are targeting nVidia hardware, you can use the same texture for input and output (but it's kinda hack). It is unpredictable result following the spec, but reality shows, that if you are reading from the same texel, where you are going to write modified value - it works. But you must be very careful, because that option is no way legal, and this approach may not work on future chipsets (for example).

Posting Permissions

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