ntut-open-source-club/practical-tools-for-simple-design

Image Alignment Issue w/ Some PNG files

Ouverte

#105 ouverte le 11 févr. 2024

 (0 commentaire) (0 réaction) (0 personne assignée)C++ (27 forks)auto 404
bughelp wanted

Métriques du dépôt

Stars
 (27 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Problem

PNG/JPG files converted from GIF (from this website) has alignment issues when displayed on screen. However, BMP files converted with the same method doesn't have these issues.

Adding glPixelStorei(GL_UNPACK_ALIGNMENT, 1) before glTexImage2D fixes the issue with PNG/JPG files, but breaks BMP files. Also, glPixelStorei(GL_UNPACK_ALIGNMENT, 1) doesn't seems to have any affect on images that are not converted from GIFs.

Demo

PNG w/o glPixelStorei(GL_UNPACK_ALIGNMENT, 1)

image

PNG w/ glPixelStorei(GL_UNPACK_ALIGNMENT, 1)

image

BMP w/o glPixelStorei(GL_UNPACK_ALIGNMENT, 1)

image

BMP w/ glPixelStorei(GL_UNPACK_ALIGNMENT, 1)

image

Proposed Workaround

Use BMP when converting from GIFs

Guide contributeur