Math question: scaling image to viewport size
I learned some OpenGL and wanna display an image in a viewport so that the image fills in the viewport as much as possible yet maintains its aspect ratio.
E.g. if viewport width/height = 800/600 and image width/height = 100/200, the image should be scaled to 300/600.
Can anyone please suggest how to construct the algorithm to get the final image size (in this example it would be 300/600)? I'm terrible at math.
Last edited by bird1500; May 28th, 2013 at 02:34 AM.