Frame Buffer Objects are Easy (ish)
Last update on .
Felt a little under the weather after a good party (apparently I picked up some soy, which I can't digest well) I decided to learn a little bit about Frame Buffer Objects in OpenGL. These are the new system that allows you to do "off screen" rendering and "rendering to texture" behaviours. Turns out they are a rather elegant, simple system. Whereas I'd always been scared off by the messy platform-dependent pbuffer system, FBOs are simple and reasonably portable.
I only hit one "gotcha" while following through this C tutorial in PyOpenGL. The tutorial mentions the gotcha, but doesn't draw the line to the problem you encounter if you the leave the operation out. The setting of image parameters is required. If you don't do it you will likely get an unsupported format error when you check to see that your FBO is "complete" (ready to render).
Anyway, the test code is in PyOpenGL CVS if you want to take a look (test_fbo), the tutorial linked above is very good about walking you through the logic and background of the extension. I'm guessing that GPGPU people would want a wrapper around the FBO setup code for doing their calculations, probably want something for day-to-day use in any system.
Not sure that belongs in PyOpenGL, however, as the API is already pretty straightforward. Might want to wrap up the check for completeness in a convenience function that explains the enumerants more humanely though.
Pingbacks are closed.
Comments are closed.