View Full Version : magnifying glass effect

10-08-2002, 04:40 AM

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

10-08-2002, 05:40 AM
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 opengl.org)

i hope this helps you a little bit.

10-08-2002, 10:25 PM

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

Best regards