diff options
Diffstat (limited to 'tex.c')
-rw-r--r-- | tex.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -9,6 +9,7 @@ #include "eprintf.h" #include "tex.h" +// png2tex: read a PNG and produce an OpenGL texture out of it GLuint png2tex(FILE *f) { png_image pi = { .version = PNG_IMAGE_VERSION }; @@ -21,6 +22,7 @@ GLuint png2tex(FILE *f) png_image_begin_read_from_stdio(&pi, f); pi.format = PNG_FORMAT_RGB; stride = sizeof *data * PNG_IMAGE_SAMPLE_CHANNELS(pi.format) * pi.width; + // OpenGL alignment requirement stride = (stride + 3) & ~(size_t)3; size = stride * pi.height; data = emalloc(size); |