FBO Render buffer vs Texture. When to use each?

Started by
5 comments, last by zedz 16 years, 6 months ago
Hi All, I noticed OpenGL has this idea of render buffers as well as textures, but you can to both using FBOs.. So I'm just wondering if I can get a good explaination on when to use a buffer and when to use a texture. For example, if I want to have a depth buffer to use in an FBO, I can create a depth/stencil render buffer or I can create a depth/stencil texture. I can't see the difference except that the texture can be bound and used as a shadow-map or whatever in a shader. So the real question is what is the advantage of a render buffer in lieu of the lack of functionality as a texture. My first guess would be that you can copy out of it easier. Is that it? Cheers! Eric
Advertisement
use renderbuffers whenever u can (performance/AA supported)
I'm not exactly sure how to answer your questions, but you can probably get some answers by looking at the official documentation of the framebuffer object extension (GL_EXT_framebuffer_object) here:

http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt
Good point about AA.

Yeah I've read over the spec in the past but when I looked recently I couldn't find where it said why you would use one over the other.
You should say what you intend to do.
If you want a Render TO Texture feature, use FBO and of course, you have to attach a texture to the FBO.

The other option is to use a simple texture and glCopyTexSubImage but that's only good if you already have something in your frame buffer. This is useful in other circumstances.

PS : AA is not supported on older GPUs like Radeon 9700 and such + FBO.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
Quote:Original post by V-man
You should say what you intend to do.
If you want a Render TO Texture feature, use FBO and of course, you have to attach a texture to the FBO.

The other option is to use a simple texture and glCopyTexSubImage but that's only good if you already have something in your frame buffer. This is useful in other circumstances.

PS : AA is not supported on older GPUs like Radeon 9700 and such + FBO.


That's interesting.
I have a Radeon 9700 pro, and according to GLee, it supports GL_EXT_framebuffer_multisample and GL_EXT_framebuffer_blit. But I am having trouble attaching a multisampled render bufffer to a fbo. The error message is INCOMPLETE ATTACHMENT. I wonder if it's 9700's problem. It is fine if the render buffer is not multisampled.
>>Yeah I've read over the spec in the past but when I looked recently I couldn't find where it said why you would use one over the other.

use RB whenever possible cause they have possible benifits of being faster/less memory, u also have biltFB (which enables fast blitting between FBO's, with resizing possible with colorFBOs)

of course if u need the resulting image as a texture u have no option but to bind a texture to it + not use a RB

This topic is closed to new replies.

Advertisement