Difference between revisions of "GL EXT framebuffer object More about FBOs"

From OpenGL Wiki
Jump to navigation Jump to search
(This material has been copied to the main article.)
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
Feel free to have a look at http://www.opengl.org/registry and have a look at the GL_EXT_framebuffer_object spec.<br>
GL 3.0 makes FBO a core feature. http://www.opengl.org/documentation/specs/
1. One of the limitations of GL_EXT_framebuffer_object is that when you bind a color buffer and then you bind a depth buffer, both must have the same
width and height or else the state of the FBO is considered invalid (incomplete).
This means if you have 1 FBO that is 64x64, another which is 512x64, another that is 1024x1024, for each of those you have to allocate a separate depth buffer (if you need depth testing of course). This obviously wastes memory.<br>
In GL 3.0, FBO became core and that limitation was removed.<br>
You can create 1 depth buffer that is 1024x1024 and bind them to all 3 FBOs. Notice that the depth buffer is large enough for even the smaller textures like 64x64.<br>
2. Is it better to make 1 FBO and bind your texture to it each time you need to render to the texture?<br>
An FBO itself doesn't use much memory. It is a state vector object. In terms of performance, each time you bind, the driver needs to validate the state which costs CPU time. Logically, it would be better to have 1 FBO per Render_To_Texture (RTT).<br>
However, it has been found that you get a speed boost if your textures is the same size and you use 1 FBO for them.<br>
If you have 10 textures that are 64x64 and 10 textures that are 512x64, make 2 FBOs. One FBO for each group.<br>
3. Can you bind the main framebuffers depth buffer as a depth buffer for your FBO?<br>
Does GL 3.0 allow using the main depth buffer? Unknown.<br>
4. Are multisample Render_To_Texture (RTT) supported?<br>
Not directly. You need GL_EXT_framebuffer_multisample and you would have to copy the contents of the AA-FBO to a standard RTT.<br>
Note that GL_EXT_framebuffer_multisample also became core in GL 3.0<br>
5. Talk about render to depth only. No color buffer.<br>
6. Talk about render to color only.<br>
7. Talk about stencil buffer.<br>
8. MRT<br>
9. MRT and cubemaps<br>

Latest revision as of 19:10, 3 September 2009