Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / 3D Theory & Graphics / Render to texture with PBOs? Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

May 14, 2005, 10:41 AM

I'm trying to figure out how to quickly render to texture to work in OpenGL and while it's working already, it's silly slow and I realize my poor graphics card is doing too much work.
This is the simple thing I currently want to do:

Render a rotating triangle into a 256x256 framebuffer.
Use this picture as a texture on a quad that I draw to screen.

And this is how I currently am doing it:

I render a triangle to the backbuffer.
I write-bind a PBO and readPixels to it.
I read-bind the same PBO and glTexImage2D that picture into a texture.
Then I paint the quad with the texture.

So, while I suppose the data never leaves the graphics card, I still copy the damn picture two times for no aparent reason. How should I do it? I would like to just paint straight into the texture, but I'm not sure that can be done? Thanks for any help,



May 14, 2005, 11:13 AM

Directly render to the texture ?

for details.

Requires the use of gl extensions though.

- Wernaeh


May 14, 2005, 11:43 AM

Mmm yeah,
But this uses the WGL_ARB_render_texture and I'm working in Linux (I don't think there's a GLX version of this extension). I'm under the impression that PBOs should provide a platform independent way of rendering to a texture? If not, how is it normaly done in UNIX? Thanks,



May 14, 2005, 01:03 PM

Humm... I'm not really a Linux guy programmingwise, so I guess I can't help you too much with that.

However, I think this call

  2. void (*glXGetProcAddressARB(const GLubyte *))();

works similiar to the normal wglGetProcAddress call, so you might after all use extensions as you would in Windows.

- Wernaeh

Christian Schüler

May 14, 2005, 04:14 PM

Instead of PBO you should be using the new EXT_render_target extension to render an image directly into a texture. This is a new extension and it is underway into the drivers.

Meanwhile, just render to the backbuffer and do a glCopyTexSubImage() from the BB to the texture. This is almost as fast as rendering directly into the texture.


May 15, 2005, 12:56 AM

Right, but the Linux platforms won't likely support WGL_* extensions.


May 15, 2005, 06:47 AM

Good point =)


May 15, 2005, 06:51 AM

Isn't that EXT_framebuffer_object now ? My ATI 9600 doesn't expose EXT_render_target, only EXT_framebuffer_object (and experimental: it exposes the entry points, but not the extension string).


May 15, 2005, 01:36 PM

You have two options :

render to a PBuffer or the Framebuffer and copy it to a texture using DglCopyTexImage2 or glCopyTexSubImage2D.

or use the newly introduced Framebffer Object (which is still slightly buggy on some drivers)

In any case never use glReadpixel because the readback from video memory is painfully slow in every cases and you'll run into a huge bandwith bottleneck(maybe pciExpress will help with that though).



May 15, 2005, 01:47 PM

Right, glCopyTexSubImage was a lot easier and faster. Thanks all.


May 16, 2005, 03:03 AM


Are you saying your ATI9600 supports EXT_framebuffer_object? Which drivers
you are using?



May 16, 2005, 04:19 AM

Yes and No. Newest Catalyst (5.4). As I said, it supports it in an inofficial manner.
EXT_framebuffer_object isn't listed in the extensions string, but you can query all the entry points successfully. Also GLEW lists it as supported.

I have yet to find any statement by ATI about EXT_framebuffer_object support, though.
I think it'll go public in the 5.5 release.

Look here:

Seems they found that the entry points don't yet work.


May 21, 2005, 06:26 AM

Hm, Catalyst 5.5 is out and things didn't change.


May 21, 2005, 06:51 AM

NVidia claim to support it though, albeit not on my fx5200.

This thread contains 14 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.