[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] PyGame / PyOpenGL Example



On Feb 13, 2008 4:28 PM, Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:
> There's also
>
> 4. Scale the texture image so that it has power-of-2 sizes
>
> which may work well enough for photographic images and such
> like where you're not too concerned about the appearance of
> fine details.
>
I've heard that approach suggested before, but In my opinion, that
approach is either inferior or equivalent in every respect to approach
1 that I mentioned (putting the image in a portion of a power of 2
texture, and draw from a subset of the texture)

The reasons why are:
1. They both take up exactly the same amount of video memory
2. Performance is worse for the scaled one because when drawing only
the original image pixels from a subset of the texture the video card
only has to lookup and filter those original pixels, but when the
image was scaled now the video card has to lookup and filter
additional pixels (it would tend to be around 2x the mem lookup)
3. Quality is worse for the scaled one, especially when rendering at
the original image size - even if you got a super awesome up scale
(like blackman or something) going into the texture, you are still
getting a bilinear filter on the rendering
4. Time to load images to the card is (ever so slightly) worse with
the scaled one, cause you have to do the scale
5. You have to write/utilize more code in the scaling case

For that reason, I would say there are only 3 sensible approaches to
the images to power-of-2 texture mapping problem, that I am aware of.