Imagination PowerVR SDK Blog

anti aliased render to texture


#1

I am using render to texture for an iPad app we’re building(based on the example in the training courses), its a full screen quad we want to do some post processing on. The edges are very jaggy and playing with the size of the texture doesn’t seem to help, is there a specific technique for achieving anti-aliasing when rendering to texture? 


#2
Hi perrynow,

Unfortunately on iOS there's no fast and easy way to perform multisampled RTT (such as using the GL_IMG_multisampled_render_to_texture extension on other platforms).

It can be done using Apple's GL_APPLE_framebuffer_multisample extension, but the process is quite convoluted and may impact performance.
First, you need to create a multisampled framebuffer object in which you render to, and then you must copy the contents of this buffer to another framebuffer with your texture attached using the commands:

Code:
glBindFramebuffer(GL_READ_FRAMEBUFFER_APPLE, msaa_framebuffer);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER_APPLE, resolved_framebuffer);
glResolveMultisampleFramebufferAPPLE();

The cost of this operation, as previously mentioned, can be quite expensive however.

#3

I doubled up the viewport, rendered it to a texture twice as big as the screen and rendered it back out normal size. Its not perfect and obviously theres a performance hit in the frag shaders, but its not bad. I will compare it to the above method.