EXT_framebuffer_object

Well I got render-to-texture via EXT_framebuffer_object working (hooray!). There were a few busted examples I found through google, but I eventually worked through it.

I’m finding that it (unsuprisingly) only works with power-of-two textures for framebuffer render targets. If I use a non-power-of-2 texture I don’t get errors, but my app grinds down from 800 FPS to about 8 seconds per frame :confused:

My question is, to those of you who are more familiar with FBO & render-to-texture, how do you deal with this limitation when what you really want is a framebuffer object exactly the size of your ‘primary’ framebuffer? Do you just render to a known region of your FBO and then clip/scale/whatever when you are rendering from your FBO?

Thanks!

Actually, NPOT textures work fine with FBO. I’ve successfully used both ARB_texture_rectangle textures on NV cards and GL20’s NPOT textures on ATI cards.

There’s only a bug with the current ATI drivers (will be fixed in Catalyst 5.9), the dimensions of NPOT textures should be multiples of 32. Also, don’t forget to use GL_NEAREST for the min/mag filters.

Ah good old ATI OGL drivers eh ??

"Use our new NPOT textures !!! (warning, texture dimension must be powers of 2) "

D.

-edit- Actually I feel stupid now. can a texture be (say) 96x96 ?? I just read ‘multiples’ as 2,4,8,16 etc etc. too much time programming i guess ! -edit-

[quote=“Daire Quinlan,post:3,topic:24263”]
Yes. Any dimension X that satisfies X % 32 == 0 works correctly. It still sucks though (imagine an image filter at 1/16 of the screen res, works at 1024x768 which downscales to 256x192, but fails at 800x600 which downscales to 200x150).

I guess the thing to do in the meantime on ATI is to just pick power-of-two dimensions that fully enclose your primary framebuffer (e.g. 1024x1024 FBO for 1024x768, 2048x1024 for 1280x1024, etc…) then adjust your texture coordinates appropriately when rendering from the FBO (e.g. a quad is (s,t)(1.0,0.75), or (s,t)(0.625,1.0) respectively).

Or with Catalyst 5.9, pick the next-highest multiple of 32 and use the same technique. Ugh. :slight_smile:

Thanks for all the help!

Why do you suggest using GL_NEAREST for the texture filters? Is there a technical or performance problem with GL_LINEAR? GL_LINEAR seems to be working for me when rendering my FBO quad to the screen, both magnified & minified.

Thanks!

Yes, sorry, that’s only necessary for fp textures.