glDrawPixels + get pixel user clicked on

Hello all,

I wanted to make a simple image viewer using opengl. I have the opengl super bible ed. 2, followed their example for drawing a simple bitmap to screen using glDrawPixels, works nicely this is just what I want.

I’d like to determine which pixel of my on screen image the user has clicked on, assuming the user could have scaled/zoomed/panned the on screen image. Say the user has zoomed to a level in which only two pixels take up the entire viewport, and they click on one, is there a way to figure which pixel that is from my original image? I know how to get the mouse coords clicked, just need to know how to translate them into my original image coordinates.

Thanks for any suggestions,
Mark

Moving to the beginner’s section.