Skip to main content
gamedev.net
🔒 Locked

Framebuffer Objects and GLSL

Started by Niddles 2 replies 1.1k views
Original Post
Niddles
Niddles
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?
V-man
V-man
If you want to do multipass rendering, then why not render to the screen? Why do you want to do RTT?
Niddles
Niddles
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?
V-man
V-man
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();

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.