OpenGL Offscreen Buffer


I need to create, and render to, an off-screen buffer in OpenGL. This buffer will be used as the cull-map for the Occluder Shadows algorithm, and creating the textures for the 3D Impostor algorithm.

What I need is say a 200x200 pixel off-screen buffer that I can render polygons too and then read pack the colour and depth buffer.

I currently do it by creating a second view-port, but this is visible on screen…it needs to be hidden hence off-screen.

Anybody know how to do this?



render to the backbuffer before you begin rendering your real scene. Then without flipping it, copy the area you rendered to into a texture. Finally clear the backbuffer, render your real scene, THEN flip.