diff options
-rw-r--r-- | generic/Image.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/generic/Image.c b/generic/Image.c index efb1333..a554a6a 100644 --- a/generic/Image.c +++ b/generic/Image.c @@ -144,7 +144,12 @@ From5r6g5b(unsigned char *data, /* * Configure the alpha value. */ - alpha = ZnGetBitmapPixel(bpixels, bstride, x, y) ? 255 : 0; + if (bpixels) { + alpha = ZnGetBitmapPixel(bpixels, bstride, x, y) ? 255 : 0; + } + else { + alpha = 255; + } /* * Dispatch the 3 color components. @@ -855,8 +860,14 @@ ZnImageTex(ZnImage image, glBindTexture(GL_TEXTURE_2D, this->i.gl.texobj); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + if (bits->bpixels) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + } + else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + } if (ZnImageIsBitmap(image)) { glTexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY4, this->bits->t_width, this->bits->t_height, |