diff options
Diffstat (limited to 'platform/gl/gl-main.c')
-rw-r--r-- | platform/gl/gl-main.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c index 4a40d4ad..cc849a2f 100644 --- a/platform/gl/gl-main.c +++ b/platform/gl/gl-main.c @@ -227,7 +227,8 @@ void texture_from_pixmap(struct texture *tex, fz_pixmap *pix) { if (tex->w > max_texture_size || tex->h > max_texture_size) fz_warn(ctx, "texture size (%d x %d) exceeds implementation limit (%d)", tex->w, tex->h, max_texture_size); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex->w, tex->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, pix->samples); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex->w, tex->h, 0, GL_RGB, GL_UNSIGNED_BYTE, pix->samples); tex->s = 1; tex->t = 1; } @@ -237,8 +238,9 @@ void texture_from_pixmap(struct texture *tex, fz_pixmap *pix) int h2 = next_power_of_two(tex->h); if (w2 > max_texture_size || h2 > max_texture_size) fz_warn(ctx, "texture size (%d x %d) exceeds implementation limit (%d)", w2, h2, max_texture_size); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w2, h2, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w, tex->h, GL_RGBA, GL_UNSIGNED_BYTE, pix->samples); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w, tex->h, GL_RGB, GL_UNSIGNED_BYTE, pix->samples); tex->s = (float)tex->w / w2; tex->t = (float)tex->h / h2; } |