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

Re: [pygame] Tiling a Rotated Bitmap



On Tue, Apr 1, 2008 at 8:32 PM, Aaron Maupin <maupin@xxxxxxxxxxxxxx> wrote:
>  That will only work if you rotate the bitmap 45 degrees.  (Or some
>  multiple of 45 degrees ;)
>
You may be right about particular rotation implementations, but in
general taking a tile and rotating it and expecting it tile is neither
guaranteed to work at 45 degrees nor is it guaranteed to not work at
other angles.

It can still be wrong at 45 degrees if your rotation is antialiased.
It can be right at odd angles if the edges pixels are not antialiased
or resampled. It can be wrong if the algorithm for determining what
pixels to draw is inconsistent. It can be right if the algorithm draws
everywhere the rotated tile has > 50% pixel coverage.

In OpenGL land that means you need either a GL_TEXTURE_WRAP_x of
GL_CLAMP_TO_EDGE_EXT or to use GL_NEAREST filtering.

In Pygame land it means you'll get seams with rotozoom, and rotate may
work as long as it's algorithm is properly consistent (although it
will be ugly nearest neighbor on the inside)