/** * \brief adjusts the GL_UNPACK_ALGNMENT to fit the stride. * \param stride number of bytes per line for which alignment should fit. */ void glAdjustAlignment(int stride) { if ((image_width * image_bytes) % 8 == 0) gl_alignment=8; else if ((image_width * image_bytes) % 4 == 0) gl_alignment=4; else if ((image_width * image_bytes) % 2 == 0) gl_alignment=2; else gl_alignment=1; glPixelStorei (GL_UNPACK_ALIGNMENT, gl_alignment); }