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.

I'm learning the basics of OpenGL with lwjgl currently, and following a guide I've got textured quads that can move around a scene.

I've been reading about Frame Buffer Objects, and I'm not really clear on their purpose and their benefit.

My understanding is that I'll create a FBO with the texture I'd like, load the FBO, draw a quad, then unload the FBO. What would the technique I'm currently doing for texture management be called, and how does it differ from using FBOs?

What are the benefits to using FBOs? How does it fit into the grand rendering scheme of things?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

FBOs aren't useful to simply apply static textures to a model. For static textures, you would initialize them using glTexImage2D during startup and then use the textures while rendering your model. This is presumably what you're doing now.

Framebuffer objects are used when you want to have a texture that is not just a static image loaded from a file, but something generated dynamically by the GPU. They allow you to capture an image rendered by the GPU, and then later use that image as a texture for further rendering. This functionality is also called "render-to-texture" and is commonly used for advanced rendering techniques.

One example of using FBOs would be for rendering the reflection in a body of water such as a lake or ocean. You'd create a texture object to hold the reflected image and attach it to an FBO; then each frame, before rendering the main scene, you'd bind the FBO and render the reflection; all the rendering output will go to the texture instead of the screen. Then you can unbind the FBO and render the scene as usual, using the texture in the water shader to produce the reflection. This way the reflection will update dynamically as the camera and other objects move around.

Other examples where you'd use FBOs include shadow mapping, post-processing, deferred shading, and many other advanced rendering techniques. You can read all about these (and the details of the reflection technique I just described) on the Web. FBOs are a key part of advanced OpenGL usage, so they're well worth spending some time with - but probably not until you've gotten a grasp on more basic OpenGL usage first.

share|improve this answer
    
Thank you! This is exactly the kind of answer I needed. It's much clearer, and now I know when I should start reading up on FBOs and what they can accomplish for me. –  sensae Nov 27 '11 at 7:04
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.