9

I am trying to write a program that writes video camera frames into a quad. I saw tutorials explaining that with framebuffers can be faster, but still learning how to do it. But then besides the framebuffer, I found that there is also renderbuffers.

The question is, if the purpose is only to write a texture into a quad that will fill up the screen, do I really need a renderbuffer?

I understand that renderbuffers are for depth testing, which I think is only for checking Z position of the pixel, therefore would be silly to have to create a render buffer for my scenario, correct?

1 Answer 1

10

A framebuffer object is a place to stick images so that you can render to them. Color buffers, depth buffers, etc all go into a framebuffer object.

A renderbuffer is like a texture, but with two important differences:

  1. It is always 2D and has no mipmaps. So it's always exactly 1 image.
  2. You cannot read from a renderbuffer. You can attach them to an FBO and render to them, but you can't sample from them with a texture access or something.

So you're talking about two mostly separate concepts. Renderbuffers do not have to be "for depth testing." That is a common use case for renderbuffers, because if you're rendering the colors to a texture, you usually don't care about the depth. You need a depth because you need depth testing for hidden-surface removal. But you don't need to sample from that depth. So instead of making a depth texture, you make a depth renderbuffer.

But renderbuffers can also use colors rather than depth formats. You just can't attach them as textures. You can still blit from/to them, and you can still read them back with glReadPixels. You just can't read from them in a shader.

Oddly enough, this does nothing to answer your question:

The question is, if the purpose is only to write a texture into a quad that will fill up the screen, do I really need a renderbuffer?

I don't see why you need a framebuffer or a renderbuffer of any kind. A texture is a texture; just draw a textured quad.

3
  • The reason I need to use a framebuffer is because as I read in some pages that is the only way to do Ping-Pong rendering. And my intention is to use such technique to apply several filter-effects, So i need a way to reuse the output of a texture after has passed through a fragment shader, to pass some other effects as required.
    – Perraco
    Mar 24, 2012 at 10:25
  • 1
    @user848253: In the future, you will be more likely to get accurate information if you are more forthcoming about what you're actually doing, rather than providing the minimal information possible. All you've said in your question is that you're trying to write a texture as a full-screen quad. Mar 24, 2012 at 10:27
  • 2
    Well, I am still putting all together because all is new to me, I am reading several tutorials, but couldn't find one that shows all the concepts straight. The overall idea is to process video frames with shaders, applying multiple filters, and then output it to a quad into the screen.
    – Perraco
    Mar 24, 2012 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.