Jump to content
  • Advertisement
Sign in to follow this  
Niddles

Framebuffer Objects and GLSL

This topic is 3364 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

Hello. The past couple of days I have been looking at GLSL and how everything associated with it works. I came to the conclusion that I should have different shader programs that I can use as I do multiple passes on a framebuffer object. I have been looking at fbo's and much to my demise, I can not figure out how to work the things. I thought you draw to the framebuffer, and then tell GL which buffer I should draw. What is the syntax to do this, as all I can find on the internet is ways to use FBO's to draw to textures. Or is that the way to do it? You render an FBO to a texture and then just draw the texture to the screen. I am really confused about all of this framebuffer object nonsense, or whether this is the right way to do my shaders for my program. I want to be able to manage my shaders like this, because of the way I have my rendering scenegraph set up. I can just add shader objects as a renderable component, and render them separately as I run down the scenegraph. Maybe I am completely missing the point of both of these?

Share this post


Link to post
Share on other sites
Advertisement
If you want to do multipass rendering, then why not render to the screen? Why do you want to do RTT?

Share this post


Link to post
Share on other sites
Hmph, maybe I have a big misunderstanding how multi-pass rendering works. I thought you had to do your passes offscreen in a fbo that you have created, and then render that to the screen. How would I do multi-passes rendering directly? Also, how much will this slow the system down? Is this the best way to go about using multiple shaders?

Share this post


Link to post
Share on other sites
How to do multipass?

glDepthFunc(GL_LEQUAL);

Pass 1:
RenderCube_with_light_1
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE); this does additive blending

Pass 2:
RenderCube_with_light_2

Pass 3:
RenderCube_with_light_3
glDisable(GL_BLEND);

SwapBuffers();

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!