magnifying glass effect


Can anybody tell me how to obtain magnifying glass effect?? I’m thinking about using glReadPixels() and gl PixelZoom() but maybe there is a better way or some example.

best regards

try this:
copy your scene into a texture.
draw a quad mapped with this texture on the screen again.
set your mapping so that every pixel lies over it’s source framebuffer position.
scale the mapping to get the zoom effect.
you can also use the 2nd texture unit (if you got one) to mask out regions of the zoom-window you want not to see (ie.a cirecle to get a round zoom window)

…or try this one:
after your draw your scene, use sntecil to mask out your zooming-area on the screen, and draw your scene again. but this time with stencil test enabled and scaled/translated according to your zooming factor. with this method you get a “real” sharp zoom (i prefer this method)

(if you don’t know how to use stencil, just take a look at the FAQ’s and tutorials on

i hope this helps you a little bit.


Thanks for answer. This second way is quite interesting. I will try.

Best regards