Results 1 to 4 of 4

Thread: Math question: scaling image to viewport size

Threaded View

  1. #1
    Join Date
    Aug 2012

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts