Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

What i need to do:

  • Blur the selected texture and pass the texture to another effect for postprocessing.
  • Notice that i want one texture passed all over.

How do i want to do this:

  • Bind the FBO ( with texture to be blurred attached as colorbuffer )
  • Change the FBO viewport size to match the texture size
  • Enable the shader
  • Bind the texture
  • Render viewport sized quad with the texture and output to that texture via FBO colorbuffer
  • Unbind texture
  • disable shader
  • Disable fbo
  • ...
  • pass that texture to another effect..

What i have already done:

  • A FBO with ColorBuffer attached ( the texture i want to blur ),
  • The shader
  • All the other reqd stuff..

What's the problem?

  • When i want to blur texture and i bind that texture as a color buffer to my FBO, and then pass the texture via uniform to the shader while rendering to sample it (and blur), the results are not stored. Seems like FBO can't have the same texture stored as output and sample it at the same time ( kind of understandable ).

Question:

  • Is this normal behavior ? How do i approach 'blur a selected texture' so that i can pass one texture over to another effect to work on it ?

I can imagine a 'dummy' texture within the effect class to which FBO renders to and then it gets copied to a texture that was requested to be modified.. Any better option ?

Thanks for shedding a bit of light on this, i think i need some logic help in here.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Render viewport sized quad with the texture and output to that texture via FBO colorbuffer

This is called a "feedback loop". It is decidedly wrong. And while texture barrier could save you in certain cases, it can't save you when you want to do a blur filter.

You're going to have to render to a different texture than you read from.

share|improve this answer
    
Thanks! i wasn't aware of the fact there's a definition for that. That's what i have finally decided to do. So render to a different texture and then copy that output into the input texture is the only way ? Or there can be something else adapted ? –  PeeS Jan 26 '13 at 23:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.