OpenGL FrameBuffer Object 101
Cleaning UpFinally, when you are done with your FBO you need to clean things up and delete it. This, like textures, is done via a single function: glDeleteFramebuffersEXT(1, &fbo); You also have to clean up any renderbuffers you might have allocated, in this case the depthbuffer renderbuffer needs to deleted, which again works the same way as cleaning up a texture: glDeleteRenderbuffersEXT(1, &depthbuffer); At this point both the FBO and the renderbuffer have been freed and your clean up is completed. Final ThoughtsHopefully this quick tour of the FBO extension will be enough to get you up and running with it. For a more detailed over view you'll want to check out the FBO spec or the section on the extension in the book More OpenGL Game Programming In way of closing, before you go and check out the example program which shows a basic usage of the FBO extension I’d like to leave you with the following tips and notes on FBO usage.
Notes on the example programWhile this article talks about adding a depth renderbuffer and then a texture to the FBO in that order it was discovered that currently ATI’s drivers appear to have a bug whereby adding the depth renderbuffer and then a texture causes the application to crash. This should be kept in mind when doing any FBO related work and tested for as it is possible it could be fixed in a future driver revision thus rendering the problem non-existent. I’d also like to put out a big thanks to Rick Appleton for helping me test out and debug the code on NVIDA hardware, couldn’t have done it without you mate :) The example program requires some form of GLUT to be compiled and run (I used FreeGLUT) ReferencesMore OpenGL Game Programming |