Sign in to follow this  
rvx

OpenGL PBO FBO TBO?

Recommended Posts

can someone explain to me what is the difference between Pixel Buffer Object : http://www.opengl.org/registry/specs/ARB/pixel_buffer_object.txt Frame Buffer Object : http://www.opengl.org/registry/specs/EXT/framebuffer_object.txt Texture Buffer Object : http://www.opengl.org/registry/specs/EXT/texture_buffer_object.txt where's the best situation (and case example) to use each buffer?

Share this post


Link to post
Share on other sites
PBOs are used for async data upload. You can store pixel data in a buffer (which is mostly stored in video memory) and later use it for commands that read/write pixel data, such as glReadPixels, glTexImage1D/2D/3D, etc.

FBOs are used for offscreen rendering and multiple render targets. You can draw to a texture or an renderbuffer. You can later read that texture in a shader to do things like postprocessing.

TBOs just allow to read a buffer object as a texture in a shader. The backing store of the texture is the buffer object data, so it's pretty generic on what it can be done with it.

Share this post


Link to post
Share on other sites
Quote:
Original post by HuntsMan
PBOs are used for async data upload. You can store pixel data in a buffer (which is mostly stored in video memory) and later use it for commands that read/write pixel data, such as glReadPixels, glTexImage1D/2D/3D, etc.

so it is used for writing pixel data to a texture, and later on the texture could be used by shader.

Quote:
FBOs are used for offscreen rendering and multiple render targets. You can draw to a texture or an renderbuffer. You can later read that texture in a shader to do things like postprocessing.

so it is mostly used for rendering to texture, ok i got it.

Quote:
TBOs just allow to read a buffer object as a texture in a shader. The backing store of the texture is the buffer object data, so it's pretty generic on what it can be done with it.

in this case the difference between TBO and PBO is, TBO make it possible that any data could be treated as a texture on shader (such as vertex position, vertex normal, indices, vertex attribs anything that stored on a buffer object), and PBO is a more specific buffer that only hold pixel data.

because its a specific buffer for pixel data, then one of its important feature is we could use opengl pixel manipulation function on it.

am I right?



Share this post


Link to post
Share on other sites
Quote:
Original post by HuntsMan
Yes. TBO's can only be read by shaders, but PBOs can be used by other GL functions.


we still could use MapBuffer function to read and write to TBO isn't it?

Share this post


Link to post
Share on other sites
if I want to build a GUI system, which is using Cairo to render it, which one is best using PBO or TBO since i don't need GL pixel manipulation, no mipmaping and no texture filtering just RGBA buffer. performance-wise?

Share this post


Link to post
Share on other sites
Quote:
Original post by V-man
I think you don't need any of them. You can just render to the backbuffer.
This says it can do GL rendering
http://en.wikipedia.org/wiki/Cairo_(graphics)


if I render to backbuffer i won't have flexibility for compositing floating/cascading window or widget, transparency, animation etc (like Compiz). and every pixel on the screen should be redraw each frame, unlike using quad texture for each surface of Cairo i can only draw which surface has changed.

Share this post


Link to post
Share on other sites
Quote:
Original post by rvx
Quote:
Original post by V-man
I think you don't need any of them. You can just render to the backbuffer.
This says it can do GL rendering
http://en.wikipedia.org/wiki/Cairo_(graphics)


if I render to backbuffer i won't have flexibility for compositing floating/cascading window or widget, transparency, animation etc (like Compiz). and every pixel on the screen should be redraw each frame, unlike using quad texture for each surface of Cairo i can only draw which surface has changed.


I don't know what you mean by compositing floating/cascading window but I have done a GUI system that draws windows and other controls and it renders to the backbuffer. I just need to do a code review some day.

Perhaps you should use FBO if you don't intend to update some of those windows. This is called RTT = render to texture
http://www.opengl.org/wiki/OpenGL_extensions#Framebuffer_related_extensions

Share this post


Link to post
Share on other sites
Quote:
Original post by V-man
Quote:
Original post by rvx
Quote:
Original post by V-man
I think you don't need any of them. You can just render to the backbuffer.
This says it can do GL rendering
http://en.wikipedia.org/wiki/Cairo_(graphics)


if I render to backbuffer i won't have flexibility for compositing floating/cascading window or widget, transparency, animation etc (like Compiz). and every pixel on the screen should be redraw each frame, unlike using quad texture for each surface of Cairo i can only draw which surface has changed.


I don't know what you mean by compositing floating/cascading window but I have done a GUI system that draws windows and other controls and it renders to the backbuffer. I just need to do a code review some day.

Perhaps you should use FBO if you don't intend to update some of those windows. This is called RTT = render to texture
http://www.opengl.org/wiki/OpenGL_extensions#Framebuffer_related_extensions


yes, indeed i was about going to use FBO for RTT, my question is whether i should use PBO or TBO to send texture data that was generated by Cairo to shader, so the shader could render those textures to a quad (which is a window) using FBO, then I send the FBO result to backbuffer and swap it to frontbuffer.

using cairo to render to backbuffer is like redrawing the rendering result to make overlay on the screen, but it was done per-frame (or screen) size which make rendering slower because i need to redraw every GUI pixel on screen to backbuffer each frame.

moreover i was going to "compose" each widget or GUI element (text, button, icon,..) as a quad and has its own texture generated by cairo only when the texture is changed.

Share this post


Link to post
Share on other sites
If you are going to get the data from a back buffer or whatever with glReadPixels from this cairo api...? I would use a PBO to read that data and send that data into your shader...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this