loadImageAsPlane()

In “pad” mode, the useful pixels of the image are embedded within a larger texture. Only the lower-left corner of the texture contains the actual content we want to display.

For instance, suppose we load a 640x480 image into a 1024x512 texture. As far as the graphics card is concerned, we are feeding it a 1024x512 texture image, it just so happens that the only part of this image we want to see is the lower-left 640x480 pixels.

But if we apply the whole texture to a card, we will see the whole texture, including the black part we don’t care about. In order to avoid rendering the black region, we have to reduce the UV’s, so instead of going from 0 … 1 on the X axis, we go from 0 … (640/1024), or 0 … 0.625. Similarly on the Y axis.

Obviously, this isn’t necessary if we had simply scaled the texture up to 1024x512 (or down to 512x256), because in that case the graphics card receives the entire texture over its entire region, so when we apply the whole texture to a card, we are seeing exactly the part we meant to see (all of it).

David