NPOT FBO Render Target

laweya 101 Feb 04, 2008 at 13:29

I’m currently working on a render target implementation using a Frame Buffer Object (FBO) , I’m running it on a Radeon X1650 which supports the GL_ARB_texture_rectangle but not the GL_ARB_texture_non_power_of_two extension.

I have attached a texture to the FBO’s first color attachment point then at a post processing step the texture is mapped to a full screen quad. My problem is that using non power of 2 dimensions for the render texture results in the rendering being extremely slow.

Could someone please tell me what the conventional way of handling non power of two render targets is?

2 Replies

Please log in or register to post a reply.

Vilem_Otte 117 Feb 04, 2008 at 13:34

Its GL_ARB_texture_rectangle extension for example. You don’t have to use GL_TEXTURE_2D as texture parameter, but GL_TEXTURE_RECTANGLE_ARB. This is nice way how to handle non power of 2 textures (well it has one disadvantage - coordinates of texture must be in 0 - windowWidth and 0 - windowHeight instead of 0 - 1)

laweya 101 Feb 04, 2008 at 13:41

Thanks for the really quick reply, I’m trying to avoid using GL_TEXTURE_RECTANGLE_ARB because
1 I’m adding OpenGL support to an existing engine who’s higher level framework already handles the post processing step and

  1. I know it can be done another way, Ogre does it pretty well and I’m currently looking at Ogre’s code but haven’t come across anything useful.
    From what I can see so far, Ogre bumps up the dimensions to the nearest power of two but I can’t figure out how the texture coordinates are generated for the new texture’s size.