PDA

View Full Version : magnifying glass effect



krol
10-08-2002, 05:40 AM
Hello

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
Martin

AdrianD
10-08-2002, 06: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.

krol
10-08-2002, 11:25 PM
Hi

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

Best regards
Marcin