Game Development Reference
In-Depth Information
In a perfect world you shouldn't have to worry much about the size of the video buffer
(especially if using software-only scalers/renderers). This is not true, however, when scaling
video using OpenGL in Android. In this case, the size of the buffer is crucial. In the next section,
you will learn how to deal with arbitrary video sizes that don't work very well with OpenGL.
When the Image Is Not a Power of Two
As mentioned before, hybrid scaling works flawlessly when the size of the image is a power
of two. However, your image buffer probably won't be a power of two. For example, the
chapter dealing with the Doom engine has a video size of 320x240. In that case, the image
will still be scaled, but to a percentage of the size of the texture. To see this effect in action,
take a look at Figures 3-10 and 3-11 .
Figure 3-10. Scaling a non-power-of-two image
In Figure 3-10 you have the following sizes:
Device display: 859x480
Texture: 512x256
Image: 320x240
As you can see, the image is scaled but to 62% (320/512 × 100) of the texture width and
93% (240/256 × 100) of the height. Therefore, the image will be scaled to 62%x93% of
any device resolution provided the resolution is greater than 256. Now let's take a look at
Figure 3-11 .
Figure 3-11. Scaling a power-of-two image
 
Search WWH ::




Custom Search