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
    Senior 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).

Similar Threads

  1. Replies: 0
    Last Post: 05-20-2014, 12:59 AM
  2. shader source names
    By hlewin in forum OpenGL: General
    Replies: 20
    Last Post: 02-20-2013, 01:59 AM
  3. Source, destination in glBlendFunc
    By swatkdw in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 07-03-2009, 06:53 AM
  4. Rendering to more then one destination camera into texture
    By nitschke in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 02-28-2006, 01:17 AM
  5. Source and Destination in Blending.
    By Brian Jones in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-13-2002, 01:34 PM

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