PDA

View Full Version : gluLookAt() and Aspect Ratio



jonathon123
04-03-2008, 11:10 AM
Hi everyone. I am a bit confused about how aspect ratio fits into the OpenGL environment. Please look at my situation.

1) gluLookAt() to set 'eye', 'lookAt', and z-axis up
2) Displaying a 2D bitmap in scene.
3) Use gluLookAt to change 'eyeY' position +-1 (since z-axis is up, changing eyeY will move the eye closer or further away from scene)
4) Linear mapping each pixel of the bitmap to x & z.
5) (trying to figure out how y relates to shift)

So, I have two questions:
1) Traversing pixel by pixel and linearly mapping to x & z is ok because the aspect ratio is maintained, right?
2) How can I get a pixel location for y that is proportional to x & z? Do I need to use the MODELVIEW matrix? Or is it a simple ratio?

Thank you

jonathon123
04-08-2008, 11:09 AM
Does anyone know?