1
\$\begingroup\$

I am rendering a scene to FBO as my render target whose size is 8 times the size of the orignal screen in OpenGL. Now i wan to downsample the texture generated by FBO to the size of the screen so as to achieve spatial anti aliasing. How do i achieve the down sampling ? Please provide implementation details.
Note : If there is a better way of doing anti aliasing in FBOs please mention that too. I am trying to remove the aliasing in the image attached below.

enter image description here

\$\endgroup\$
  • 1
    \$\begingroup\$ I feel sorry for your GPU \$\endgroup\$ – deceleratedcaviar Nov 16 '11 at 2:34
  • \$\begingroup\$ How are you drawing the grid? \$\endgroup\$ – Nicol Bolas Nov 16 '11 at 8:27
  • \$\begingroup\$ @NicolBolas a texture for 1X1 sqaure block and then I am mapping it all over the grid. \$\endgroup\$ – snape Nov 16 '11 at 8:34
1
\$\begingroup\$

Since your render target is exactly 8 times the size of the screen, I'd just use glGenerateMipmap, after setting glTexParameteri(..., GL_TEXTURE_MAX_LEVEL, 3);. Then, just blit or whatever from mipmap level 3, and you're done.

But really, you're wasting a lot of performance by not using multisampling+aniso. Supersampling won't give you much that you won't get with multisampling and anisotropic filtering, and your rendering will be that much faster for it.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ You could also replace blitting with simply drawing a textured sprite that covers the screen area exactly, that also works for non power of 2 scaling. \$\endgroup\$ – aaaaaaaaaaaa Nov 16 '11 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.