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.
 
d00sint2

May 14, 2005, 10:41 AM

Hello,
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,

Erik

 
Wernaeh

May 14, 2005, 11:13 AM

Directly render to the texture ?

See
developer.nvidia.com/attach/6725
for details.

Requires the use of gl extensions though.

Cheers,
- Wernaeh

 
d00sint2

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,

Erik

 
Wernaeh

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

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


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

Cheers,
- 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.


 
Reedbeta

May 15, 2005, 12:56 AM

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

 
Wernaeh

May 15, 2005, 06:47 AM

Good point =)

 
Chris

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).

 
PixelClear

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)
http://oss.sgi.com/projects/ogl-sample/registry/EXT/framebuffer_object.txt

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).

Phil

 
d00sint2

May 15, 2005, 01:47 PM

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

 
dreddi

May 16, 2005, 03:03 AM

Chris,

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

dReddi

 
Chris

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:
http://www.gamedev.net/community/forums/topic.asp?topic_id=313189

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

 
Chris

May 21, 2005, 06:26 AM

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

 
d00sint2

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.