4
\$\begingroup\$

I am newbie writing a post-processing code for mobile devices, and asking some trivial, conventional solution for a specific problem.

AFAIK, post-processing in OpenGL is trivially done with FBO bound to a texture. Anyway, target screen size is usually not square and non-POT(power-of-two) numbers, while texture size needs to be the POT numbers. For example, iPhone 4 screen size is 640x960 pixels. Because all textures need to be POT sized, texture size for post-processing should be 1024x1024 to cover all the pixels. But in this case, over half of the pixels are just wasted. It really feels bad to me. Because simply wasted amount is huge.

Of course I can use smaller 512x512 texture if the post-processing doesn't need to be pixel-perfect. But still, I waste large portions of memory if I keep aspect-ratio. I can fill the texture by adjusting aspect-ratio, but in this case, we need to adjust fragment shader algorithms to get correct result.

Here're my questions.

  1. If I need pixel-perfect post-processing, should I use larger texture which wasting large portion of it? Is this trivial? Or is there better solution? (For example, binding multiple small texture patches to a FBO.)

  2. If I use smaller texture, what is trivial method to handle the aspect-ratio issue? Just use only small portion of the texture keeping aspect-ratio? Or adjust the fragment shader algorithm?

\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

After doing some googling around, it appears that OpenGL ES 2 actually does support non-pow2 textures, but not (necessarily) with mipmaps or repeat wrap mode (source). Fortunately, for postprocessing you don't need mipmaps or repeat wrap mode, so you can size the textures to match the framebuffer exactly.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .