Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/dfmoore/ on line 14
Notes: Frame Buffer Objects



Frame Buffer Objects

Jan 16, 01:56 PM

Keywords: FBO, GLUT, Macintosh, Xcode, Platform agnostic, Render to a texture, example, tutorial.

So, if you’ve wanted to learn how to use FBO’s to render to a texture, and have spent any amount of time on the internet, you were probably suckered into thinking you’d have them up in no time, and then just to find all sorts of issues: White textures, crashes, blah blah blah.

After three days of piecing together tutorials, I give you this: One .cpp file that renders a texture mapped cube to an FBO, and then renders to the screen a cube that has been re-mapped with the first pass. It loads tga’s, and cleans up after itself properly.

I’ll give proper credit where credit is due:
for a nice rotating cube starting block.

This source is meant to be a learning tool; I didn’t notice any explicit copyrights on the code I moved between, but if you’re doing something more than just looking at it, I’d suggest using this as a guide to writing your own.

[Download the sourcefile here]
Setup in Xcode:
1. Start a new C++ tool.
2. Import the OpenGL and GLUT frameworks.
3. Drag in the source file you’ve downloaded from here.
4. Include a test image called [NeHe.tga] in your build directory (more notes on that in the source file).
5. Compile and enjoy!