Jump to content
  • Advertisement
Sign in to follow this  
SFA

OpenGL Shaders and FBOs

This topic is 3493 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm currently working on a project where I first need to perform some (GLSL) shading on a scene, and then capture the results into an FBO to do some post processing. Pseudo code: --------------------- Setup OpenGL Enable(FBO) Enable(Shader) DrawObjects() Copy FBO to texture Do some work on the texture Render texture to screen space quad Disable(Shader) Disable(FBO) --------------------- This setup works perfectly fine for the most part. The problem is that I have a parameter that I adjust using the keyboard, that's passed to the shader to change the brightness of certain objects. With the FBO disabled, this works fine. But if the FBO is active (that is, simply re-drawing the exact same render to texture then screen), adjusting the parameter has no effect on the image! Have I got anything wrong here?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by SFA
The problem is that I have a parameter that I adjust using the keyboard, that's passed to the shader to change the brightness of certain objects. With the FBO disabled, this works fine. But if the FBO is active (that is, simply re-drawing the exact same render to texture then screen), adjusting the parameter has no effect on the image! Have I got anything wrong here?

Impossible to say with this limited information.

BTW, there are some anomalies in the process you mentioned. You don't need to "copy FBO to texture". The entire purpose of an FBO is to avoid exactly this step. DrawObjects() will directly draw into the texture, no need to copy anything. Second, are you sure that you want to use the same shader to generate the texture and to render it to screen ? Or is it some type of recursive algorithm ? In the latter case, you might have to use ping-pong'ing, since you cannot read and write from/to the same texture at the same time.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!