def gl_get_alignment(width):
    """Determines a textures byte alignment.

    If the width isn't a power of 2
    we need to adjust the byte alignment of the image.
    The image height is unimportant

    www.opengl.org/wiki/Common_Mistakes#Texture_upload_and_pixel_reads
    """
    alignments = [4, 8, 2, 1]
    for alignment in alignments:
        if width % alignment == 0:
            return alignment
