PDA

View Full Version : 2x zoom (pixelated)



qwerber
09-05-2011, 12:15 AM
So what do I do to make things 2x zoom? I'm using openGL and SDL.

BionicBytes
09-05-2011, 03:24 AM
I think a little more detail is needed than just "..2x zoom".
Can you describe your sceanero and what you are trying to do?

Dark Photon
09-05-2011, 05:54 PM
So what do I do to make things 2x zoom? I'm using openGL and SDL.

By 2x pixellated zoom, I assume you mean you want a framebuffer that looks something like this:


1 1 51 51 25 25
1 1 51 51 25 25
16 16 89 89 75 75
16 16 89 89 75 75


There are a number of ways. One being to render to a half-res corner of the window. Copy that off to a texture with glCopyTexImage2D, then render that back to the framebuffer at 2X size with a textured QUAD, with texture filtering set to GL_NEAREST.

Yet another way: render half-res to an off-screen texture via framebuffer object (FBO), then blit it to the window via glBlitFramebuffer, scaling to full res and with a filter arg of GL_NEAREST.