I am trying to implement a zoom in/out navigation mode in a openGL 3dViewer. I was able to implement zoom functionality centered at screen center just by moving eye towards the center in perspective mode.
Now i am trying to do the zoom centered at arbitrary position under the cursor. I am unable to figure out how should i move my camera forward and backward such that point under cursor remains at the same screen coordinates after zoom in/out. Any help would be appreciated.
Below are the images which show the desired effect. Just to mention, I am working in a perspective mode with eye target and up vectors to control camera.
Same effect i found in google sketchup and 'zoom to mouse position' setting in blender.