Framebuffer Objects

Overview

This sample demonstrates Framebuffer objects (FBOs) via the EXT_framebuffer_object extension. FBOs provide an efficient method to perform off-screen rendering.

Requirements

You may use FBOs if you create an OpenGL 3.0 context or if the EXT_framebuffer_object extension string is present.

In the first case, FBOs are exposed as core functions (GL). In the second case, FBOs are exposed via extensions (GL.Ext).

Sequence of Events

In this example, one color texture and one depth texture are created. Then a Framebuffer Object is created and both textures are attached to it as drawing surfaces. The Framebuffer Object is changed to become the current drawing buffer, a clearscreen is performed (in red) and a Torusknot object is drawn (in green).
Then, the window-system provided framebuffer is made current again, and the color and depth textures are drawn as simple quads on-screen.